Skip to content

Instantly share code, notes, and snippets.

View wedneyyuri's full-sized avatar

Wédney Yuri wedneyyuri

View GitHub Profile
@wedneyyuri
wedneyyuri / stream-backpressuring-example.js
Created January 31, 2018 16:00
Backpressuring in Streams
const Readable = require('stream').Readable;
const Writable = require('stream').Writable;
let counter = 0;
const readable = new Readable({
read(size) {
counter++;
this.push(counter.toString());
(function(self) {
'use strict';
// if (self.fetch) {
// return
// }
var support = {
searchParams: 'URLSearchParams' in self,
iterable: 'Symbol' in self && 'iterator' in Symbol,
blob: 'FileReader' in self && 'Blob' in self && (function() {
@wedneyyuri
wedneyyuri / WebsocketClient.java
Last active February 12, 2016 09:26
Adapter for SailsJS in Socket.IO - sails.io.js in Java
// Adaptador para conectar o Socket.IO no SailsJS - Socket Client (sails.io.js)
// https://github.com/socketio/socket.io-client-java
package br.com.example.websocket;
import android.util.Log;
import com.github.nkzawa.emitter.Emitter;
import com.github.nkzawa.socketio.client.Ack;
import com.github.nkzawa.socketio.client.IO;
@wedneyyuri
wedneyyuri / shuffle.js
Created August 25, 2015 23:19
UnderscoreJS lightweight method: shuffle
var shuffle = (function(){
var random = function(min, max) {
return min + Math.floor(Math.random() * (max - min + 1));
};
return function(set) {
var length = set.length;
var shuffled = Array(length);
for (var index = 0, rand; index < length; index++) {
rand = random(0, index);
@wedneyyuri
wedneyyuri / OpenWithSublimeText2.bat
Last active August 29, 2015 14:27 — forked from mrchief/LICENSE.md
Add "Open with Sublime Text 2" to Windows Explorer Context Menu (including folders)
@echo off
SET st2Path=C:\Program Files\Sublime Text 2\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 2\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 2" /t REG_SZ /v "" /d "Open with Sublime Text 2" /f