Skip to content

Instantly share code, notes, and snippets.

@hallettj
hallettj / global-variables-are-bad.js
Created February 14, 2009 21:15
How and why to avoid global variables in JavaScript
// It is important to declare your variables.
(function() {
var foo = 'Hello, world!';
print(foo); //=> Hello, world!
})();
// Because if you don't, the become global variables.
(function() {
@psychemedia
psychemedia / Cross Domain JQuery with Yahoo Pipes Proxy
Created February 27, 2010 12:20
Make cross domain JSON calls in JQuery for JSON feeds that don't support JSONP. Using a Yahoo Pipe as a proxy, pass in the URI for your JSON feed from any domain, and grab the Pipe's JSONP proxy output into your page.
function cross_domain_JSON_call(url){
// url points to a JSON feed
// eg http://openlylocal.com/committees.json?council_id=111
url="http://pipes.yahoo.com/ouseful/jsonproxy?url="+encodeURIComponent(url)+"&_render=json&_callback=?";
$.getJSON(
url,
function(data) { myCallbackFunction(data.value.items[0]); }
)
@alotaiba
alotaiba / google_speech2text.md
Created February 3, 2012 13:20
Google Speech To Text API

Google Speech To Text API

Base URL: https://www.google.com/speech-api/v1/recognize
It accepts POST requests with voice file encoded in FLAC format, and query parameters for control.

Query Parameters

client
The client's name you're connecting from. For spoofing purposes, let's use chromium

lang
Speech language, for example, ar-QA for Qatari Arabic, or en-US for U.S. English

@kevinSuttle
kevinSuttle / meta-tags.md
Last active March 22, 2024 09:36 — forked from lancejpollard/meta-tags.md
List of Usable HTML Meta and Link Tags
@ryanohs
ryanohs / gist:2048500
Created March 16, 2012 04:24
Merge Sort - CoffeeScript
mergesort = (input) ->
n = input.length
if n == 1
return input
pivot = Math.floor n/2
a = mergesort input[0...pivot] # coffee script does not include the last element in a slice
b = mergesort input[pivot...n]
merge(a, b)
merge = (a, b) ->
@yalue
yalue / deadwood.rb
Last active January 12, 2022 23:47
Gin rummy optimal meld finder and deadwood calculator in ruby
#!/usr/bin/ruby
#
# If you want to understand how this script works, I'd recommend starting to read it
# at the "entry point" where it starts validating and parsing the arguments---just
# look for the lines interacting with ARGV to get the initial list of cards. From
# there you can follow how it generates the full set of candidate melds (which may
# overlap) and then how it builds a "tree" where each path to a leaf node defines a
# non-overlapping set of melds.
usage = "deadwood.rb:
@captn3m0
captn3m0 / index.mkd
Created June 16, 2012 06:13 — forked from AartiNdi/Hash Functions.
Brief summary of what I know about hash functions

##BLOG ON CRYPTOGRAPHY

Today, people in general relate to cryptography mostly in regard to the security of their passwords. The passwords are worthless if others have resources to know it.

Today most of the websites dont simply use cryptographic hash functions like SHA256, MD5 etc. directly on the password. Instead random bits ( salt ) are added while encrypting them so that even when two users enter the same password the hashes that are generated are different from each other.

Hashes like SHA1 , SHA256, MD5 etc. are general purpose hashes. They have been designed to hash a large amount of data as quickly as possible.

An encryption algorithm for securely storing your password should have the following characteristics:

@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active February 16, 2024 04:32 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@bomberstudios
bomberstudios / muji-dotted-paper.ps
Created July 20, 2012 11:24
Print your own Muji dotted paper in A4 format (open in Preview.app, print at 100% scale)
%!PS-Adobe-3.0
% Title: dot grid paper, 5x5 mm
%%BeginSetup
%%BeginFeature: *PageSize A4
<< /PageSize [ 595.27 841.889 ]
/ImagingBBox null
>> setpagedevice
%%EndFeature
%%EndSetup
@addyosmani
addyosmani / cranium.js
Last active February 7, 2019 15:02
Cranium
/* Cranium MVC
* A minimalist MVC implementation written for
* demonstration purposes at my workshops
* http://addyosmani.com
* Copyright (c) 2012 Addy Osmani; Licensed MIT */
var Cranium = Cranium || {};
// Set DOM selection utility