Skip to content

Instantly share code, notes, and snippets.

function resizeTextarea () {
while (this.get("scrollHeight") > this.get("offsetHeight")) {
this.set("rows", this.get("rows") + 1);
}
while (this.get("rows") > 3 && this.get("scrollHeight") < this.get("offsetHeight")) {
this.set("rows", this.get("rows") - 1);
}
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Eugene Kashida</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/reset-fonts-grids/reset-fonts-grids.css">
<style type="text/css">
require.paths.push('/usr/local/lib/node/');
var sys = require('sys'),
http = require('http'),
express = require('express'),
jsdom = require('jsdom');
var app = express.createServer();
var responseLogic = function(req, res, callback) {
var window = jsdom.jsdom().createWindow();
@ekashida
ekashida / npm segfault
Created January 23, 2011 22:35
make link seems to work
22:33:20 jib:npm $ git pull
Already up-to-date.
22:33:28 jib:npm $ ls
LICENSE Makefile README.md bin cli.js doc html lib man1 npm-completion.sh npm.js package.json scripts test
22:33:30 jib:npm $ make
node cli.js install npm
npm info it worked if it ends with ok
npm info using npm@0.2.15
npm info using node@v0.3.6-pre
npm info fetch http://registry.npmjs.org/npm/-/npm-0.2.15.tgz
@ekashida
ekashida / How to be a cafe terrorist (Mac version)
Created April 7, 2011 18:11
Many cafes limit wifi usage by keeping track of your MAC address. To get around this limitation, simply spoof your MAC address every time your session expires.
# create the following symlink if the airport command in the next step cannot be found
sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
# disconnect your machine from the wireless network without turning off airport
sudo airport -z
# spoof a mac address on your wireless interface (random hex values work fine)
sudo ifconfig en1 ether 00:1f:5b:ce:0d:e4
# reconnect!
@ekashida
ekashida / gist:983495
Created May 20, 2011 18:29
Execute a collection of tasks in parallel and wait for all of them to finish before executing the callback
function doAll(collection, callback) {
var left = collection.length;
collection.forEach(function(fun) {
fun(function() {
if (--left == 0) callback();
});
});
};
var result = [];
From 40254b255250d5b889699eb655c8d30c00d322a3 Mon Sep 17 00:00:00 2001
From: Tim Caswell <tim@creationix.com>
Date: Thu, 19 Aug 2010 18:58:28 -0700
Subject: [PATCH] Make process.nextTick worlds faster for large queues.
---
src/node.js | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/node.js b/src/node.js
@ekashida
ekashida / funkyclosure.js
Created May 20, 2011 19:37 — forked from andrewvc/funkyclosure.js
from node-streamlogger.js
for (var logLevel in this.levelList) {
this[logLevel] = (function(logLevel) {
return function (message,callback) {
this.logAtLevel(message, this.levelList[logLevel], callback);
}
})(logLevel);
}
});
@ekashida
ekashida / fiddle.css
Created May 15, 2012 22:51
app creation/deletion without cl
iframe {
display: block;
}
@ekashida
ekashida / trello-poller.js
Created November 2, 2012 17:11
trello progress poller for google drive spreadsheets
/*global UrlFetchApp:true,Utilities:true,SpreadsheetApp:true*/
var KEY = <API_KEY>,
TOKEN = <TOKEN>,
BOARD = <BOARD_ID>,
BLACKLIST_RE = /stories/i; // list column names to ignore using regex alternation
function trelloFetch(request) {
'use strict';
var url = 'https://api.trello.com/1/' + request + '?key=' + KEY + '&token=' + TOKEN,