Skip to content

Instantly share code, notes, and snippets.

Julien Valéry darul75

View GitHub Profile
@darul75
darul75 / async.js
Created Mar 14, 2019 — forked from bschwartz757/async.js
Async/await function to fetch data from multiple URLs in parallel
View async.js
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@darul75
darul75 / Google_oAuth.js
Created Jan 15, 2019 — forked from entaq/Google_oAuth.js
Google oAuth 2.0 sample
View Google_oAuth.js
/**
reference -
https://developers.google.com/accounts/docs/OAuth2WebServer
https://code.google.com/apis/console/
https://developers.google.com/+/api/latest/
**/
////handle all requests here
function doGet(e) {
@darul75
darul75 / fetch-image-as-blob.js
Last active Sep 28, 2018
fetch image resources : works well with chrome extension
View fetch-image-as-blob.js
FetchImageAsBlob('https://gist.github.com/fluidicon.png', function(err, img) {
if (err) {
console.log(err);
return;
}
// play with img
});
@darul75
darul75 / introrx.md
Created Nov 9, 2015 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
View ramda-compose.js
// Example Data
var CARS = [
{name: "Ferrari FF", horsepower: 660, dollar_value: 700000, in_stock: true},
{name: "Spyker C12 Zagato", horsepower: 650, dollar_value: 648000, in_stock: false},
{name: "Jaguar XKR-S", horsepower: 550, dollar_value: 132000, in_stock: false},
{name: "Audi R8", horsepower: 525, dollar_value: 114200, in_stock: false},
{name: "Aston Martin One-77", horsepower: 750, dollar_value: 1850000, in_stock: true},
{name: "Pagani Huayra", horsepower: 700, dollar_value: 1300000, in_stock: false}
];
@darul75
darul75 / ramda.js
Created Sep 8, 2015
ramda functional js exercice
View ramda.js
// Exercise 1
//==============
// Refactor to remove all arguments by partially applying the function
var words = function(str) {
return _.split(' ', str);
};
var match = R.curry(function(what, x) {
return x.match(what);
View gist:3a729200f89ab2b0452b
/*********************************************************/
// Exercise: Readers
// https://tour.golang.org/methods/11
package main
import "code.google.com/p/go-tour/reader"
type MyReader struct{}
View gist:6b418da7281ca43c5786
var fs = require('fs');
Int64 = require('node-int64');
var varint = require('varint');
var lazy = require("lazy");
// http://braindrivendevelopment.com/2013/10/31/reading-a-file-in-node-js/
// http://lucene.apache.org/core/3_0_3/fileformats.pdf
var bufferSegmentGen = fs.readFileSync('./segments.gen');
var bufferSegments = fs.readFileSync('./segments_4o4');
View gist:3545dff26a396be35ac1
/*
GITHUB MARKDOWN EXTRACTOR RULES
https://guides.github.com/features/mastering-markdown/
http://www.table-ascii.com/
http://www.loc.gov/marc/specifications/specchartables.html
http://www.utf8-chartable.de/unicode-utf8-table.pl
View github.css
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
You can’t perform that action at this time.