Skip to content

Instantly share code, notes, and snippets.

View crismanNoble's full-sized avatar

Cris Noble crismanNoble

View GitHub Profile
@jamalsa
jamalsa / gist:660704
Created November 3, 2010 02:14
Use YQL to get title and description from website
<?php
// Set root url, which point to yahoo api
$root = 'http://query.yahooapis.com/v1/public/yql?format=json&diagnostics=true&callback=cbfunc';
// Get title from google
$titleUrl = $root . '&q=' . urlencode("select content from html where url = 'http://google.com' and xpath = '//title'");
// Get description from google
$descUrl = $root . '&q=' . urlencode("select content from html where url='http://google.com' and xpath = '//meta' and name='description'");
// Process it
@aemkei
aemkei / LICENSE.txt
Created October 27, 2011 17:16 — forked from 140bytes/LICENSE.txt
Lorenz Attractor - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tecoholic
tecoholic / osm2geo.js
Created November 27, 2011 04:57
OSM2GEO - A JS Converter to convert OSM to GeoJSON
/**************************************************************************
* 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/
*
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
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"
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
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
);
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@methodin
methodin / bookmarklet.html
Created August 25, 2012 17:02
Bookmarklet to support html5 drag/drop image/file password generation
<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
@crismanNoble
crismanNoble / Chrome to Kippt
Created August 28, 2012 19:41
Importing Chrome Bookmarks 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
@bzerangue
bzerangue / update-hosts.sh
Last active March 3, 2020 13:54
A small shell script that will add and remove lines from the hosts file. Originally created by Claus Witt, http://clauswitt.com/319.html.
#! /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}
@davidsirr
davidsirr / gist:4976499
Last active March 2, 2021 09:07
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
# 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