Skip to content

Instantly share code, notes, and snippets.

View danro's full-sized avatar
👀

Dan Rogers danro

👀
View GitHub Profile
// validation mixin
var validation = {
getDefaultProps: function () {
return {
validate: []
}
}
, hasErrors: function () {
var errors = []
@danro
danro / uri.js
Created February 23, 2013 03:03 — forked from jlong/uri.js
more href tricks
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 June 20, 2012 02:37 — 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
(*
* 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 June 16, 2012 21:58 — forked from benatkin/hello.js
http/https server with node + express + ufw
// 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 June 14, 2012 21:05 — forked from Marak/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers
/*
* 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 November 4, 2011 01:48 — forked from gasi/README.md
Node & npm Installation Instructions

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 October 31, 2011 00:00 — forked from atypical/blah.js
Read and Clean
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 October 28, 2011 17:58 — forked from mhammonds/HideMobileAddressBar.js
Hide Browser Address Bar - Android + iPhone
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 September 29, 2011 21:33 — forked from ryanb/github_tree_slider.js
This is how GitHub's new AJAX file browser works.
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)/)) {