Skip to content

Instantly share code, notes, and snippets.

Joel Brandt joelrbrandt

Block or report user

Report or block joelrbrandt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@joelrbrandt
joelrbrandt / get.js
Last active Aug 29, 2015
getting the contents of a url as a string using node
View get.js
var getURL = function (url, cb) {
var http = require("http");
var result = "",
finished = false;
var finishedHandler = function (err, val) {
if (!finished) {
finished = true;
cb(err, val);
@joelrbrandt
joelrbrandt / drag.html
Created Jul 24, 2014
in-window drag test
View drag.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Draggable - Default functionality</title>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<style>
#draggable { width: 150px; height: 150px; padding: 0.5em; border: thin solid black; background-color: white;}
</style>
View keybase.md

Keybase proof

I hereby claim:

  • I am joelrbrandt on github.
  • I am joelrbrandt (https://keybase.io/joelrbrandt) on keybase.
  • I have a public key whose fingerprint is 4180 C780 88D4 FA7E 2C7F A110 2A65 A817 C946 ACE5

To claim this, I am signing this object:

@joelrbrandt
joelrbrandt / main.js
Created Feb 3, 2014
Launch new generator-core from old generator-core
View main.js
(function () {
"use strict";
function startDumping(theGenerator) {
setInterval(function () {
console.log("[UPDATED-LAUNCHER] requesting doc info");
theGenerator.getDocumentInfo().done(
function (info) {
console.log("[UPDATED-LAUNCHER] got doc info: %s", JSON.stringify(info, null, " "));
}, function (err) {
@joelrbrandt
joelrbrandt / examplePluginMain.js
Created Jan 22, 2014
getPixmap Bounds Shim Addresses bug #134 in Adobe Generator core, which is present in core versions prior to 2.0.2: https://github.com/adobe-photoshop/generator-core/issues/134 This shim _should_ replace getPixmap with a backwards compatible version. Additionally, if the core is at least as new as 2.0.2 or the shim has already been loaded, it wi…
View examplePluginMain.js
(function () {
"use strict";
var _generator = null,
_config = null;
function init(generator, config) {
_generator = generator;
_config = config;
@joelrbrandt
joelrbrandt / send_gmail.py
Created Sep 11, 2013
Send an email through gmail's smtp using python
View send_gmail.py
import smtplib
hostname = 'smtp.gmail.com'
port = 587
username = 'someone@gmail.com'
from_address = 'someone@gmail.com'
from_name = 'Someone Doe'
password = '1234'
def send_email(to_address, to_name, subject, message):
View each_with_index.coffee
Handlebars.registerHelper 'each_with_index', (array, fn) ->
buffer = ''
for i in array
item = i
item.index = _i
buffer += fn(item)
buffer
View gist:6189321
{
"version": "0.2.0",
"timeStamp": 1375921607.634,
"id": 1116,
"file": "Sans titre-1",
"bounds": {
"top": 0,
"left": 0,
"bottom": 340,
"right": 454
@joelrbrandt
joelrbrandt / stream-first-buffer-length-bench.js
Created Jul 14, 2013
Benchmark test for reading from Node.js stream2, with addition of a firstBufferLength property
View stream-first-buffer-length-bench.js
(function () {
"use strict";
var stream = require("stream");
var i, b,
startTime, endTime, totalTime,
readCount, bytesRead, bytesReadThisTest,
rs;
@joelrbrandt
joelrbrandt / stream-perf-test.js
Created Jul 9, 2013
Test performance of various ways of reading from node v0.10 streams
View stream-perf-test.js
(function () {
"use strict";
var stream = require("stream");
var b, i, j, t, count;
var OUTER_LOOP_ITERATIONS = 1000,
INNER_LOOP_ITERATIONS = 100,
BLOCK_SIZE = 10000;
You can’t perform that action at this time.