Skip to content

Instantly share code, notes, and snippets.

@webdesserts
webdesserts / corgi.coffee
Created August 13, 2012 04:33
Corgi Bomb modified
# Description:
# Corgime
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
@webdesserts
webdesserts / correct.rb
Created July 4, 2012 16:19
How to tell your programmer to go grocery shopping
#The Ruby code your mom should have handed you:
# products = { milk => [], eggs => [] }
# cart = []
cart << products[:milk].pop
if !products[:eggs].empty?
6.times do
cart << products[:eggs].pop
@webdesserts
webdesserts / https.rb
Created May 24, 2012 19:50
This is a snippet of code for connecting to an https server via Ruby's Net::HTTP class
uri = URI('https://www.your-site.com/home/')
https = Net::HTTP.new(uri.host, uri.port)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_NONE
# use OpenSSL::SSL::VERIFY_PEER instead and https.ca_file for a verified cert
https.start do |http|
request = Net::HTTP::Get.new uri.request_uri
request.basic_auth 'username','password'
response = https.head('/home/')
@webdesserts
webdesserts / arrays.js
Last active October 1, 2015 23:57
How to pass values into an array - a snippet for some friends
var array = []
array[1] = "a value"
array[2] = "a new value"
console.log(array) // returns ["a value","a new value"]
// p.s. console.log() and alert() are interchangeable. If you use console.log the
// message appears in your browser's console rather than in a popup.
// That's kinda obvious but here's something your probably haven't used yet:
@webdesserts
webdesserts / languages.md
Last active August 29, 2015 14:15
Programming languages that should exist
@webdesserts
webdesserts / prototype.js
Last active August 29, 2015 14:10
Prototype .create() pattern
// create a "Class-like" object
var Point = {}
// create an object like this one, but with a clean state
Point.create = function create () {
var new_shape = Object.create(this)
new_shape.init.apply(new_shape, arguments)
return new_shape
}
@webdesserts
webdesserts / AlchemistAPI.js
Last active August 29, 2015 14:08
Alchemist API
/**========================================*
* Alchemist.js - Exploring a possible API *
*=========================================*/
/**=============*
* Conversions *
*=============**/
@webdesserts
webdesserts / javachip.md
Last active August 29, 2015 13:57
Conceptual exploration of what JavaScript could be

JavaChip

JavaChip my attempt to make JavaScript simpler, more predictable, and provide control-flow tools to make development in an asyncronous environment more comfortable.

Conventions

[] – a collection of data (arrays, lists, dicts, hashes)