Skip to content

Instantly share code, notes, and snippets.

View saginadir's full-sized avatar
:octocat:

Sagi saginadir

:octocat:
View GitHub Profile
@saginadir
saginadir / cat_enum.go
Last active December 15, 2020 20:41
Golang robust enum
package enums
// < ----- This is your core template
type CatEnum interface{
enum() catEnumStruct
}
type catEnumStruct struct {}
func (c catEnumStruct) enum() catEnumStruct {
@saginadir
saginadir / dyslexify
Last active August 26, 2018 08:15
Quick add for OpenDyslexic-Font to any page
(function dyslexify() {
document.head.innerHTML = `<style>
@font-face {
font-family: myFirstFont;
src: url('https://s3-eu-west-1.amazonaws.com/open-dyslexic/OpenDyslexic3-Regular.woff');
}
* {
font-family: myFirstFont !important;
}
@saginadir
saginadir / cpp_consoleLog.cpp
Created August 13, 2017 07:53
Always wanted the JavaScript console.log function in cpp? well now you have it:
void consoleLogHelper() {};
template <typename T>
void print(T t) {
std::cout << t << " ";
}
template <typename T, typename...Ts>
void consoleLogHelper(T &&first, Ts&&... rest) {
// print it
#include <iostream>
using namespace std;
int main()
{
int size, temp;
cout << "insert number" << endl;
cin >> size;
int arr[size];
package uploader
import (
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws"
// ...
)
package main
import (
"my_app/replace_file_lines"
"my_app/uploader"
// ...
)
package replace_file_lines
import (
// ...
)
// Variables that begin with an uppercase is exposed
var PublicVariable int = 42
// While those that begin with loweracse are private to the module
var privateVariable int = 0
#include <iostream>
using namespace std;
int main()
{
int num, c, d, e;
do {
cout << "Enter a 2 digit numbers:"<< endl;
cin >> num;
int main() {
return 0;
}
const capitalize = (string) =>
string.charAt(0).toUpperCase().concat(string.slice(1));
const saveToDb = (db, entity) =>
() =>
db.save(entity);
const html = (selector, newHtml) =>
() =>
$(selector).html(newHtml);