Skip to content

Instantly share code, notes, and snippets.

View velotiotech's full-sized avatar

Velotio Technologies velotiotech

View GitHub Profile
#include <iostream>
template <typename T>
void func(T&& t) {
T y = t;
t += 3;
std::cout << y << " ";
}
int main() {
int c = 5;
fn get_char(data: String) -> char {
data.chars().last().unwrap()
}
fn string_uppercase(mut data: &String) {
data = data.to_uppercase();
println!("{data}");
}
import Clarity from 'clarity';
Clarity.initialize('YOUR_CLARITY_TRACKING_CODE');
npm install clarity@latest‍ 
yarn add clarity@latest
const obj = {
value: 29,
method: function() {
const nested = () => {
console.log("LOG 1: ",this.value);
};
nested();
}
};
const obj = {
value: 29,
method: function() {
const nested = () => {
console.log("LOG 3:",this.value);
};
nested();
}
};
const obj2 = {
#include <stdio.h>
int main() {
char c = 'D';
char *cp = &c;
int *ip = (int*)cp;
*ip = 0x64567842;
printf("%c\n", c);
return 0;
}
struct Provider: TimelineProvider {
// Provides a placeholder entry while the widget is loading.
func placeholder(in context: Context) -> DayEntry {
DayEntry(date: Date(), configuration: ConfigurationIntent())
}
// Provides a snapshot of the widget's current state.
func getSnapshot(in context: Context, completion: @escaping (DayEntry) -> ()) {
let entry = DayEntry(date: Date(), configuration: ConfigurationIntent())
completion(entry)
struct Provider: TimelineProvider {
// Provides a placeholder entry while the widget is loading.
func placeholder(in context: Context) -> DayEntry {
DayEntry(date: Date(), configuration: ConfigurationIntent())
}
// Provides a snapshot of the widget's current state.
func getSnapshot(in context: Context, completion: @escaping (DayEntry) -> ()) {
let entry = DayEntry(date: Date(), configuration: ConfigurationIntent())
completion(entry)
import WidgetKit
import SwiftUI
@main
struct MonthlyWidgetBundle: WidgetBundle {
var body: some Widget {
MonthlyHolidayWidget()
MonthlyWidgetLiveActivity()
}
}