Skip to content

Instantly share code, notes, and snippets.

View amitguptagwl's full-sized avatar
🏠
Working from home

Amit K Gupta amitguptagwl

🏠
Working from home
View GitHub Profile
@amitguptagwl
amitguptagwl / protobuf-writefloat.js
Created September 11, 2018 02:12
Encoding float value as per google protobuf implementation
const assert = require('assert');
//var buf = new Uint8Array(4);
var buf = [];
var split64High, split64Low;
BinaryConstants = {
FLOAT32_MIN : 1.1754943508222875e-38,
FLOAT32_MAX : 3.4028234663852886e+38,
TWO_TO_23 : 8388608
}
@amitguptagwl
amitguptagwl / makeItCollapsible.js
Created June 27, 2018 04:59
api.checklist.com
//Following snippet make the nested tasks collapsible
$("ol.task li").each(function(){
var subtasks = $(this).find(".subtasks ol li");
if(subtasks.length !== 0){
$( $( $(this).children()[0] ).children()[0] ).prepend('<span class="expandable">-</span>');
}
});
const util = require('util');
const process = require('process');
const sleep = util.promisify(setTimeout);
var a = function(callback){
callback();
}
a(async function(){
console.log("print me first");
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class VisitorPatternExample {
public static void main(String[] args) {
List<String> list = new ArrayList<String>();
//list.add("java");
list.add("pdf");