Skip to content

Instantly share code, notes, and snippets.

View DTrejo's full-sized avatar

David Trejo DTrejo

View GitHub Profile
@max-mapper
max-mapper / index.js
Last active May 9, 2021 02:20
fast loading of a large dataset into leveldb
// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')
@artursapek
artursapek / southwest.sh
Last active December 22, 2015 02:18
Checks in for your Southwest flight. Schedule this for a little bit before your 24-hour time and it will run until it succeeds, and get you an early boarding number and therefore a good seat.
# POSTs your confirmation key, first name, and last name
# to Southwest.com check-in endpoint over and over
# until it doesn't see the 24-hour error.
# In testing I never got rate-limited or blocked
# but I didn't let it run for very long at a time
# so use at your own risk. :)
# Six-character SW confirmation token here
CONF=AB1234
#!/usr/bin/env ruby
require 'base64'
require 'open-uri'
# file or url
def get_css(src)
if src.start_with? 'http'
src = src.gsub('|', '%7C')
STDERR.puts "# GET #{src}"
# simulate modern browser to get woff
@tj
tj / example.js
Created July 31, 2013 18:48
console.api()
function params(fn) {
var str = fn.toString();
var sig = str.match(/\(([^)]*)\)/)[1];
if (!sig) return [];
return sig.split(', ');
}
console.api = function(obj){
console.log();
var proto = Object.getPrototypeOf(obj);
@mikeal
mikeal / gist:6084298
Last active December 20, 2015 06:18
Been rather busy....

Because I've been so busy lately I haven't really had a chance to talk about anything I've built or been using, but i've been publishing so many new modules it's worth going back over.

Real quick, Getable is a mobile/desktop ordering and fullfillment application for commercial construction. Think mobile amazon/ebay for large construction jobsites.

First off, everything is realtime, using engine.io with everything but long polling turned off. We tried leaving websockets on but there were some nasty bits that made the connection die and not come back on iPhone which we just couldn't debug in time so we turned it off.

Engine.io is a great module as it just provides a simple duplex stream-like (more on this later) interface that upgrades itself when available. This meant that in order to get some use out of it I had to write a few modules.

eiojson sends JSON messages rather than strings bidirectiona

@max-mapper
max-mapper / readme.md
Last active May 28, 2021 17:35
list of things that are like tacos
@DTrejo
DTrejo / find-console.log.js
Created April 7, 2013 22:52
find rogue console.log that snuck into your code, or other people's code
var cl = console.log
console.log = function() {
cl(arguments.callee.caller.toString())
cl.apply(console, arguments)
};
// then grep through your code for that function.

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for Google TV

Consumer key: iAtYJ4HpUVfIUoNnif1DA

@timoxley
timoxley / gist:4697136
Last active December 30, 2019 07:56
Things I learned about Voxel.JS today

Terminology

  • block/voxel/cube -> mostly interchangeable. The minecrafty blocks you see on the screen.
  • chunk: is a piece of the world that contains voxels
  • AABB: bounding volume
  • voxeljs: not 100% consistent yet, 'voxel.js' also acceptable, but definitely not 'VoxelJS'.
  • dims: short for 'dimensions'. Perhaps obvious to some.

Positions

@remixz
remixz / GHCATS.md
Last active March 25, 2020 16:10
GitHub for Cats

Full version out! http://zachbruggeman.me/github-for-cats/

GitHub For Cats

Because cats just wanna have forks.

Introduction:

If you’re a cat, you probably haven’t heard of GitHub. Maybe your human companion has, but they don’t really know how to explain it to you. (Which, as a cat, is extremely frustrating.) GitHub is a website that allows content creators, whether it be via programming, blogging, or issue-reporting, to collaborate together and to learn from each other. It’s powered by a “distributed version control system” called git. A “distributed version control system” sounds pretty complicated, but it really isn’t. What it really means is that lets you, a cat, manage all of the stuff you have made (like maybe some JavaScript?) in one place, and be able to go back in time to see what you did before. It also lets other cats (or maybe humans) see what you’ve done, and help you out with it. This guide will get you introduced to the world of git and GitHub, and it might even