Skip to content

Instantly share code, notes, and snippets.

View vijayee's full-sized avatar

Victor Morrow vijayee

View GitHub Profile
@vijayee
vijayee / htmldiff.js
Created July 23, 2022 13:54
html diff converted from coffescript
(function() {
var Match, calculate_operations, consecutive_where, create_index, diff, find_match, find_matching_blocks, html_to_tokens, is_end_of_tag, is_start_of_tag, is_tag, is_whitespace, isnt_tag, op_map, recursively_find_matching_blocks, render_operations, wrap;
is_end_of_tag = function(char) {
return char === '>';
};
is_start_of_tag = function(char) {
return char === '<';
};
@vijayee
vijayee / coins.js
Created October 14, 2019 12:47
Coins for Elliot
function coins (arr, value, index) {
if (! arr.length) {
return 0
}
if (typeof(index) === 'undefined') {
index = arr.length - 1
arr.sort((a, b) => a - b)
}
if (index < 0) {
@vijayee
vijayee / next-loop.js
Created March 15, 2019 20:35
asynchronous looping with callbacks
function echo (value, cb){
setTimeout(() => {
cb(value)
}, 0)
}
let i = i
let next = (val) => {
if (val) {
console.log(val)

Keybase proof

I hereby claim:

  • I am vijayee on github.
  • I am vijayee (https://keybase.io/vijayee) on keybase.
  • I have a public key ASALjz2CEnFDbJteC8vQ1ej_jwm7c8Vdif-5RfbqI6HDRwo

To claim this, I am signing this object:

@vijayee
vijayee / migration.js
Last active November 17, 2015 03:20
ID Migration
var idSeq= new sequence(0);
processIds= function(res) {
var ids = res.body.rows.map(function(row) {
var obj= {};
for (var property in row) {
if(String(property).indexOf('id') != -1) {
obj[property] = row[property];
}
}
return obj;
@vijayee
vijayee / gist:18aed69eb64d444c4cb1
Created April 14, 2015 18:14
Have global go function return local go function to otto javascript runtime
// Sandbox
package main
import (
"github.com/robertkrimen/otto"
"reflect"
)
func parameterize(call otto.FunctionCall, method reflect.Value) []reflect.Value {
m := method.Type()