Skip to content

Instantly share code, notes, and snippets.

View nrk's full-sized avatar
🤔
はい、猫のように見えます。

Daniele Alessandri nrk

🤔
はい、猫のように見えます。
View GitHub Profile
# Function to print hierarchical call trees as the program executes.
# Use "ir.exe -trace" for IronRuby
$CALL_DEPTH = 0
p = proc { |op, file, line, method, b, cls|
if op == "call"
filename = file.nil? ? nil : file.gsub('\\','/')
puts "#{$CALL_DEPTH}\t" + ('| ' * $CALL_DEPTH) + "> #{cls}::#{method} #{filename}:#{line}"
locals = eval("local_variables", b)
local_values = locals.each { |l|
@endolith
endolith / Has weird right-to-left characters.txt
Last active July 17, 2024 12:41
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
import scala.xml._
def googleLocalisation(adr: String) : Option[(Double, Double)] = {
val url = "http://maps.google.com/maps/api/geocode/xml?sensor=false&address="
val xml = XML.load(url+adr)
if ((xml \ "status" text) == "OK") {
val lat = ((xml \ "result" \ "geometry" \ "location" \ "lat") text).toDouble
val lng = ((xml \ "result" \ "geometry" \ "location" \ "lng") text).toDouble
Some((lat, lng))
} else {
'''
redis_search.py
Written by Josiah Carlson July 3, 2010
Released into the public domain.
This module implements a simple TF/IDF indexing and search algorithm using
Redis as a datastore server. The particular algorithm implemented uses the
actions = {
:on_next => proc {|next_value| puts "Next: #{next_value}" },
:on_error => proc {|exception| puts "Exception: #{exception.message}"},
:on_completed => proc { puts "done!" }
}
observer = Observer.new actions
observable = Observable.range(2,2, Scheduler.new_thread).select_many do |x|
Observable.range(x * 3, 3, Scheduler.new_thread)
end
class Proc
def <<(other)
case other
when Proc
Proc.new do |*args|
call(other.call(*args))
end
else
call(other)
end
<?php
// Define the 'class' class
$class = Obj()
->fn('new', function ($class) {
$newClass = Obj($class->methods)
->fn('new', function($class) {
$obj = Obj($class->imethods);
$args = func_get_args();
array_shift($args);

Rebasing Merge Commits in Git

This morning I discovered a nasty little problem with git-rebase that can have pretty unexpected and unwanted results - how it handles a merge commit.

The TL;DR version is this: Always use git rebase -p

Why I use pull --rebase

I think a lot of people are using git pull --rebase as their default to avoid unnecessary merge commits when fetching the latest code from master. There are a few blog posts on the matter, such as [1] [2]

@shripadk
shripadk / gist:652819
Created October 29, 2010 03:10
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'