Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
See my social media for status.

Aria Stewart aredridel

💭
See my social media for status.
View GitHub Profile
@aredridel
aredridel / file1.js
Last active August 29, 2015 13:56 — forked from anonymous/file1.js
View file1.js
var exec = require('child_process').exec;
function wew(cb){
exec("iwlist wlan2 scan|grep -Po '(?<=Address: )\\S+|(?<=Signal level=)\\S+|(?<=ESSID:\")[^\"]+'", test(cb));
}
function test(cb) {
return function (error, stdout, stderr) {
var out = stdout.replace(/^\s+/mg, '');
out = out.split('\n');
@aredridel
aredridel / DataUrl.ometajs
Last active August 29, 2015 13:56
Parsing data URL with ometajs
View DataUrl.ometajs
ometa DataUrl {
scheme = "data:",
type = /[a-z-]+/,
charset = /[a-z-]+/,
mimeType = type "/" type ( ";charset=" charset )?,
charset =
@aredridel
aredridel / keybase.md
Last active August 29, 2015 13:57
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am aredridel on github.
  • I am aredridel (https://keybase.io/aredridel) on keybase.
  • I have a public key whose fingerprint is 7181 12A2 A598 9A18 C5C6 733A 382C 45D1 EB10 1DAC

To claim this, I am signing this object:

@aredridel
aredridel / Async Code Katas I.md
Created March 17, 2014 05:09
Asynchronous Code Katas for Javascript
View Async Code Katas I.md

Asynchronous Javascript Code Katas

Part 1: Simple values, sequential flow

Write a synchronous get function and set function. Get a value, set a value, get again.

function makeThing() {
	var val = 0;
	return {
View dependencies-for-google-API.java
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.store.DataStoreFactory;
import com.google.api.client.util.store.FileDataStoreFactory;
import com.google.api.services.androidpublisher.AndroidPublisher.Builder;
View server.js
var fs = require('fs');
var http = require('http');
var png = fs.readFileSync('x.png.txt', 'utf8');
http.createServer(function (req, res) {
res.setHeader('Content-Type', 'image/png');
res.end(new Buffer(png, 'base64'));
}).listen(8080);
@aredridel
aredridel / index.js
Last active August 29, 2015 14:11
Refactoring to continuation-passing
View index.js
var http = require('http');
var bl = require('bl');
function start(callback) {
option = {};
options.path = '/start';
var req = http.request(options, function (res) { res.pipe(bl(callback)) });
req.end();
}
View gist:af54aa661068f5650fc5
4-6 servings.
3.5 oz dried rice noodles, cooked; or use spaghetti
2 carrots, grated
1/2 medium napa cabbage, shredded finely (regular cabbage works too)
5 cloves of garlic, minced
1 tablespoon fresh ginger, grated
3 green onions, sliced
1/2 to 1 teaspoon sesame oil
1 to 2 tablespoons brown sugar
@aredridel
aredridel / promise-tap.js
Created September 3, 2015 17:30
Evil hack
View promise-tap.js
var P = require('bluebird');
var tap = require('tap');
var pt = wrap(tap);
function wrap(orig) {
return Object.create(orig, {
test: {
value: function(name, options, cb) {
if (!cb) {
cb = options;
View NEW_API.txt
Proposed API for HTML5 parser in Javascript
var HTML5 = require('html5')
HTML5.parse(string, [{DOM: domModule}]) -> DOM objects
new HTML5.Parser(source, [{DOM: domModule}]) -> eventEmitter with "document" property. emits "end" when fully parsed, and the document property is a DOM tree
Internal: