Skip to content

Instantly share code, notes, and snippets.

View junosuarez's full-sized avatar
💭
hi hello

juno suárez junosuarez

💭
hi hello
View GitHub Profile
@macintux
macintux / presentation-tips.md
Last active November 28, 2022 01:03
Public speaking tips
@Raynos
Raynos / callbacks.js
Last active August 18, 2022 22:25 — forked from wycats/promises.js
// The well-known callback pattern
fs.mkdir("some-path", function(err) {
fs.open("some-path/file", "w", function(err, fd) {
var buffer = new Buffer("hello world")
fs.write(fd, buffer, 0, buffer.length, null, function(err, bytes) {
console.log("Wrote " + bytes + " bytes")
})
})
})
@wycats
wycats / promises.js
Last active December 15, 2015 15:09
// This is just an example of nested callbacks. I know you could achieve this
// goal with simpler code but I'm just showing an example
// The well-known callback pattern
fs.mkdir("some-path", function(err) {
fs.open("some-path/file", "w", function(err, fd) {
var buffer = new Buffer("hello world");
fs.write(fd, buffer, 0, buffer.length, null, function(err, bytes) {
console.log("Wrote " + bytes + " bytes");
@max-mapper
max-mapper / readme.md
Last active January 28, 2024 18:11
How-to: Write a node module with voxel.js

Writing node modules with voxel.js

This is a short guide that will teach you the workflows that have been figured out by the voxel.js community for writing node modules + sharing them on NPM and Github. It is assumed that you have a basic understanding of JavaScript, github and the command line (if not you can check out an introduction to git and the command line or learn JS basics from JavaScript for Cats)

The voxel-tower repository on github contains all the example code from this guide.

Table of contents

@max-mapper
max-mapper / readme.md
Last active December 13, 2015 23:39
node + npm explanation from #voxel.js irc

21:57 < dook> You seem to be new to node, is that right?

21:57 < skidz> good to know... yes.. very

21:57 < skidz> but familar with JS but mostly a C# programmer

21:58 < dook> Ok so the basic premise is that to make Chrome run javascript fast, they made a JS->C++ compiler called V8

21:58 < dook> It makes JS compile into very fast, efficient code.

@max-mapper
max-mapper / index.js
Created November 27, 2012 01:28
link to lat/lon in native maps app on ios and android from webview (phonegap)
var mapLink = "http://maps.google.com/maps?z=12&t=m&q=loc:" + lat + "+" + lon
if ($.os.ios && navigator.userAgent.match(/iPhone OS 6_/)) mapLink = "Maps://?q=" + lat + "," + lon
if ($.os.android) mapLink = "geo:" + lat + "," + lon + "?z=12&q=" + lat + "," + lon
// assumes you have zepto and zepto.detect loaded
// also you should use target=_blank on your <a> tags
@neilj
neilj / window-controller.js
Last active November 4, 2022 21:41
Cross-tab window controller
function WindowController () {
this.id = Math.random();
this.isMaster = false;
this.others = {};
window.addEventListener( 'storage', this, false );
window.addEventListener( 'unload', this, false );
this.broadcast( 'hello' );
@jlongster
jlongster / gist:3881008
Created October 12, 2012 19:28
js destructuring macro
// Note: there are bugs in hygienic renaming, so this doesn't work all the time yet.
macro varr {
case [$var (,) ...] = $expr => {
var i = 0;
var arr = $expr;
$(var $var = arr[i++];) ...
}
@PhillyCDO
PhillyCDO / philly-open-data-order.md
Created September 4, 2012 17:08
Open Data Executive Order for the City of Philadelphia

OPEN DATA AND GOVERNMENT TRANSPARENCY

WHEREAS, the City of Philadelphia is committed to creating a high level of openness and transparency in government; and

WHEREAS, the three principles of transparency, participation, and collaboration form the cornerstone of an open government; and

WHEREAS, the City’s participation as a founding and vital partner in the open data consortium has provided a model for transparency on which the City should continue to build; and

WHEREAS, more City data sets should be published and made available via an Open Data Portal which will provide access to information and a mechanism for public feedback and participation; and

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs