Skip to content

Instantly share code, notes, and snippets.

@endolith
endolith / Has weird right-to-left characters.txt
Last active June 1, 2024 10:58
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
# This is just a dummy example of a property with a "fallback" mechanism
# that an adapter should use if it doesn't know how to natively persist
# a property value.
#
# In this case we're dealing with an array that some datastores can persist
# and others need to call dump before persisting and load after retrieving
# a property value.
module DataMapper
class Property
@schacon
schacon / classy_git.md
Created November 12, 2010 20:48
RubyConf Talk
@julesfern
julesfern / compact-logger.js
Created December 16, 2010 17:26
A tiny javascript logger
// Create the logger singleton
window.logger = {
"messages": [],
"debug": function(msg, object) { window.logger.log("debug", msg, object); },
"warn": function(msg, object) { window.logger.log("warn", msg, object); },
"error": function(msg, object) { window.logger.log("error", msg, object); },
"log": function(level, msg, object) {
window.logger.render(level, msg, object)
window.logger.messages.push([level, msg, object]);
},
@knowtheory
knowtheory / prettyprint.js
Created April 11, 2011 05:44
A pretty printer for Javascript objects that looks like Ruby's pp formatter. In use on Rhino, untested elsewhere.
function pp(object, depth, embedded) {
typeof(depth) == "number" || (depth = 0)
typeof(embedded) == "boolean" || (embedded = false)
var newline = false
var spacer = function(depth) { var spaces = ""; for (var i=0;i<depth;i++) { spaces += " "}; return spaces }
var pretty = ""
if ( typeof(object) == "undefined" ) { pretty += "undefined" }
else if ( typeof(object) == "boolean" ||
typeof(object) == "number" ) { pretty += object.toString() }
else if ( typeof(object) == "string" ) { pretty += "\"" + object + "\"" }
@julesfern
julesfern / gist:970584
Created May 13, 2011 13:59
spah-readme.mdown

Spah: Single-Page Application Helper

Contents

# These are my notes from the PragProg book on CoffeeScript of things that either
# aren't in the main CS language reference or I didn't pick them up there. I wrote
# them down before I forgot, and put it here for others but mainly as a reference for
# myself.
# assign arguments in constructor to properties of the same name:
class Thingie
constructor: (@name, @url) ->
# is the same as:
@daksis
daksis / Raw Links
Created June 17, 2011 15:04
Bayesian Network Resources
# server
require 'rubygems'
require 'sinatra'
get '/temp' do
content_type :json
temp = `./temper`
bits = temp.split(' ')
"{ \"time\" : #{bits[0]}, \"fahrenheit\" : #{bits[2].gsub(/F/,'')}, \"celcius\" : #{bits[3].gsub(/C/,'')} }"