Skip to content

Instantly share code, notes, and snippets.

Cris Noble crismanNoble

Block or report user

Report or block crismanNoble

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
View bling.js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@davidsirr
davidsirr / gist:4976499
Last active Dec 13, 2015
a no-nonsense guide to setting up an rbenv based ruby on rails development environment on OSX using homebrew, rbenv, bundler, pow, anvil note: all these commands are to be entered at the terminal
View gist:4976499
# get homebrew http://mxcl.github.com/homebrew/
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# remove RVM ruby manager if installed... (credit http://etehtsea.me/migration-from-rvm-to-rbenv)
rvm implode
sudo rm /etc/rvmrc
rm ~/.rvmrc
# use homebrew to install rbenv and ruby-build
brew update
@bzerangue
bzerangue / update-hosts.sh
Last active Jul 7, 2019
A small shell script that will add and remove lines from the hosts file. Originally created by Claus Witt, http://clauswitt.com/319.html.
View update-hosts.sh
#! /bin/sh
# @author: Claus Witt
# http://clauswitt.com/319.html
# Adding or Removing Items to hosts file
# Use -h flag for help
DEFAULT_IP=127.0.0.1
IP=${3:-$DEFAULT_IP}
@niftylettuce
niftylettuce / getscript.js
Last active Nov 17, 2017
getScript() - load scripts asynchronously w/375 bytes of code - e.g. `getScript(src, cb)`
View getscript.js
// # getScript()
// more or less stolen from jquery core and adapted by paul irish
function getScript(url,success) {
var head = document.getElementsByTagName("head")[0], done = false;
var script = document.createElement("script");
script.src = url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete") ) {
@crismanNoble
crismanNoble / Chrome to Kippt
Created Aug 28, 2012
Importing Chrome Bookmarks to Kippt
View Chrome to Kippt
//Export Chrome bookmarks as html
//Manually add a id="target" to the <d1> under the <h3> of the folder you want to import
//Initialize your list
var list = '';
//save the children of your target
var target = document.getElementById('target').children;
//grab all the titles and links, format them for easy importation to Kippt API
@methodin
methodin / bookmarklet.html
Created Aug 25, 2012
Bookmarklet to support html5 drag/drop image/file password generation
View bookmarklet.html
<a href="javascript:(function(){var head=document.getElementsByTagName('head')[0];var e=document.createElement('script');e.src='//crypto-js.googlecode.com/svn/tags/3.0.2/build/rollups/sha256.js';head.appendChild(e);e=document.createElement('style');e.innerHTML='.picpass-active {background:#aaffaa !important;z-index:10000}';head.appendChild(e);e=document.createElement('script');e.src='//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js';head.appendChild(e);var inter=setInterval(check,100);var runs=0;function check(){if(typeof jQuery!='undefined'){run();clearInterval(inter);}if(++runs>60){clearInterval(inter);}}function run(){var dropzone=$('input[type=password]');dropzone.css({'zIndex':10000});var dropped=null;var content=null;$('body').on('dragstart',function(e){if(e.srcElement.src){content=e.srcElement.src;}});dropzone.on('dragover',function(e){e.preventDefault();$(this).addClass('picpass-active');});dropzone.on('dragleave',function(e){e.preventDefault();$(this).removeClass('picpass-active');});dropzo
View queenOfHearts.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nijikokun
nijikokun / example-user.js
Created May 3, 2012
Beautiful Validation... Why have I never thought of this before?!
View example-user.js
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@jlong
jlong / uri.js
Created Apr 20, 2012
URI Parsing with Javascript
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"
@tecoholic
tecoholic / osm2geo.js
Created Nov 27, 2011
OSM2GEO - A JS Converter to convert OSM to GeoJSON
View osm2geo.js
/**************************************************************************
* OSM2GEO - OSM to GeoJSON converter
* OSM to GeoJSON converter takes in a .osm XML file as input and produces
* corresponding GeoJSON object.
*
* AUTHOR: P.Arunmozhi <aruntheguy@gmail.com>
* DATE : 26 / Nov / 2011
* LICENSE : WTFPL - Do What The Fuck You Want To Public License
* LICENSE URL: http://sam.zoy.org/wtfpl/
*
You can’t perform that action at this time.