Skip to content

Instantly share code, notes, and snippets.

View imerkle's full-sized avatar

imerkle imerkle

View GitHub Profile
@imerkle
imerkle / gist:5c8a39e05cbc08a1142f57e0fcbf3071
Created April 30, 2018 16:15 — forked from leonardo-m/gist:6e9315a57fe9caa893472c2935e9d589
A selection of 101 LINQ Samples converted to Rust
// Port of the C# 101 LINQ Samples rewritten into Apple's Swift 3.
#![feature(ordering_chaining, step_by)]
fn main() {
// linq5: Where - Indexed
/*
//c#
public void Linq5()
{
(function() {
var COLORS, Confetti, NUM_CONFETTI, PI_2, canvas, confetti, context, drawCircle, i, range, resizeWindow, xpos;
NUM_CONFETTI = 350;
COLORS = [[85, 71, 106], [174, 61, 99], [219, 56, 83], [244, 92, 68], [248, 182, 70]];
PI_2 = 2 * Math.PI;
@imerkle
imerkle / theme.json
Last active November 2, 2017 22:51
Example theme.json for barterdex
{
"direction": "ltr",
"palette": {
"AppBg": "#fbbf40",
"AppSectionBg": "#FFF",
"AppSectionHeaderBg": "#175d42",
"RootColor": "#333",
"AppBgImageHeight": "660px",
"AppSectionTypoBg": "#f9f9f9",
"AppSectionTypoColor": "#868686",
@imerkle
imerkle / commandslinux.txt
Created September 7, 2017 18:12
important linux commands
fuser -k 8080/tcp
history -c && history -w
command &
ps -ef | grep something // show bg process
@imerkle
imerkle / csv.txt
Created September 2, 2017 19:55
uncomment the xhr https://repl.it/KeAf
function countSyllables(word)
{
var vowels = [ 'a', 'e', 'i', 'o', 'u', 'y' ];
var currentWord = word.match(/\S/g);
var numVowels = 0;
var lastWasVowel = false;
var sylabels = [];
var charset = "";
[{
"FIELD1": "System",
"FIELD2": "Region",
"FIELD3": "Pronunciation1_Syllables",
"FIELD4": "Pronunciation1",
"FIELD5": "Pronunciation2_Syllables",
"FIELD6": "Pronunciation2",
"FIELD7": "Pronunciation3_Syllables",
"FIELD8": "Pronunciation3"
},{"FIELD1":"Tanoo","FIELD2":"Derelik","FIELD3":"2","FIELD4":"ta-nu","FIELD5":"","FIELD6":"","FIELD7":"","FIELD8":""},{"FIELD1":"Lashesih","FIELD2":"Derelik","FIELD3":"3","FIELD4":"la-she-si","FIELD5":"","FIELD6":"","FIELD7":"","FIELD8":""},{"FIELD1":"Akpivem","FIELD2":"Derelik","FIELD3":"3","FIELD4":"ak-pi-ven","FIELD5":"","FIELD6":"","FIELD7":"","FIELD8":""},{"FIELD1":"Jark","FIELD2":"Derelik","FIELD3":"1","FIELD4":"jark","FIELD5":"","FIELD6":"","FIELD7":"","FIELD8":""},{"FIELD1":"Sasta","FIELD2":"Derelik","FIELD3":"2","FIELD4":"sas-ta","FIELD5":"","FIELD6":"","FIELD7":"","FIELD8":""},{"FIELD1":"Zaid","FIELD2":"Derelik","FIELD3":"1","FIELD4":"zeid","FIELD5":"","FIELD6":"","FIELD7":"","FIELD8":""},{"FIELD1":"Yuzier","FIELD2":"Derelik","FIELD3":"2",
[
{
"FIELD1": "Tanoo",
"FIELD2": "Derelik",
"FIELD3": "2",
"FIELD4": "ta-nu",
"FIELD5": "",
"FIELD6": "",
"FIELD7": "",
"FIELD8": ""
@imerkle
imerkle / thumbnail_test.json
Last active August 8, 2017 20:06
thumbnail preview test file
{
"res" : [
{
"src": "https://i9.ytimg.com/sb/9FoW9PcxIAU/storyboard3_L1/M0.jpg?sigh=rs%24AOn4CLC1irgit83PPeEv4gotrypPNphf7A",
"x": 0,
"y": 0,
"w": 159,
"h": 89.5
},
{
@imerkle
imerkle / colorfromstring.txt
Created July 26, 2017 16:57
genarate color from string
const getHashCode = str => {
let hash = 0;
for (let i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
return hash;
};
const getHSL = (number, saturation, lightness) => {
var shortened = Math.abs(number % 360);
@imerkle
imerkle / annotest.json
Last active July 16, 2017 22:39
json of anootiation
{
"res": [
{
"end": 10000,
"start": 4000,
"text": "4 to 10 seconds im show",
"style": {
"height": 200
}
},