Skip to content

Instantly share code, notes, and snippets.

View validate-example.js
// validation mixin
var validation = {
getDefaultProps: function () {
return {
validate: []
}
}
, hasErrors: function () {
var errors = []
@danro
danro / uri.js
Created Feb 23, 2013 — forked from jlong/uri.js
more href tricks
View uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@danro
danro / finder-open-iterm-here.scpt
Created Jun 20, 2012 — forked from cowboy/finder-open-iterm-here.scpt
Finder Open iTerm Here: Drop a folder on this script (or just run it) to open a new iTerm window there. If the selected item isn't a folder, it will open the item's parent folder. Great when bound to a hotkey in FastScripts or added to the Finder Sidebar
View finder-open-iterm-here.scpt
(*
* Finder Open iTerm Here - v1.0.2 - 4/14/2011
* http://benalman.com/
*
* Copyright (c) 2011 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
tell application "Finder"
@danro
danro / hello.js
Created Jun 16, 2012 — forked from benatkin/hello.js
http/https server with node + express + ufw
View hello.js
// I edited this using the ACE editor bookmarklet
// http://ajaxorg.github.com/ace/build/textarea/editor.html
var express = require('express'),
fs = require('fs');
var app = express.createServer({
key: fs.readFileSync('positive.key'),
cert: fs.readFileSync('positive.pem'),
ca: fs.readFileSync('positive-chain.crt')
});
@danro
danro / base64.js
Created Jun 14, 2012 — forked from Marak/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
View base64.js
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
*
*/
var base64 = exports;
base64.encode = function (unencoded) {
@danro
danro / README.md
Created Nov 4, 2011 — forked from gasi/README.md
Node & npm Installation Instructions
View README.md

Node

Installation

git clone https://github.com/joyent/node.git
cd node/
git checkout v0.4.5 # or any other version you'd like
./configure --debug
make install
@danro
danro / blah.js
Created Oct 31, 2011 — forked from atypical/blah.js
Read and Clean
View blah.js
function parseTheDashboardData(resp){
var httpStatus = resp.meta.status,
httpMessage = resp.meta.msg,
dashboardPostsArray = resp.response.posts;
for (var i = 0; i < dashboardPostsArray.length; i++){
var current=dashboardPostsArray[i];
var blogName = current.blog_name
, blogID = current.id
@danro
danro / HideMobileAddressBar.js
Created Oct 28, 2011 — forked from mhammonds/HideMobileAddressBar.js
Hide Browser Address Bar - Android + iPhone
View HideMobileAddressBar.js
function configAddressBar (addHeight) {
var defaultHeight = 50;
if (typeof addHeight == "undefined") addHeight = 1;
function hideAddressBar() {
if(!window.location.hash)
{
if(document.height < window.outerHeight)
{
document.body.style.height = (window.outerHeight + defaultHeight + addHeight) + 'px';
}
@danro
danro / github_tree_slider.js
Created Sep 29, 2011 — forked from ryanb/github_tree_slider.js
This is how GitHub's new AJAX file browser works.
View github_tree_slider.js
GitHub.TreeSlider = function () {
if (window.history && window.history.pushState) {
function a() {
if (e.sliding) {
e.sliding = false;
$(".frame-right").hide();
$(".frame-loading:visible").removeClass("frame-loading")
}
}
if (!($("#slider").length == 0 || !GitHub.shouldSlide)) if (!navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {