Skip to content

Instantly share code, notes, and snippets.

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

Daniele Alessandri nrk

🤔
はい、猫のように見えます。
View GitHub Profile
@markoa
markoa / deploy.rb
Created October 10, 2011 13:31
Ingredients to monitor Resque with God automatically via Capistrano (on Ubuntu)
namespace :deploy do
desc "Hot-reload God configuration for the Resque worker"
task :reload_god_config do
sudo "god stop resque"
sudo "god load #{File.join(deploy_to, 'current', 'config', 'resque-' + rails_env + '.god')}"
sudo "god start resque"
end
end
# append to the bottom:
@ircmaxell
ircmaxell / Brainfuck.php
Created September 23, 2011 13:58
Brainfuck PHP Interpreter
<?php
require_once 'Memory.php';
require_once 'Stack.php';
require_once 'Expressions.php';
class Brainfuck {
public function run($code, $input, $eof = 0) {
$memory = new Memory(array_map('ord', str_split($input)), $eof);
# igrigorik { ~ } > rvm use jruby
# Using /Users/igrigorik/.rvm/gems/jruby-1.6.2
# igrigorik { ~ } > gem install mvn:org.clojure:clojure
# Successfully installed mvn:org.clojure:clojure-1.3.0.b.1-java
# 1 gem installed
require 'rubygems'
require 'java'
require 'maven/org.clojure/clojure'
@addyosmani
addyosmani / visibly.js
Created August 3, 2011 12:44
Cross-browser Page Visibility API polyfill
/*!
* isVis - v0.5.5 Aug 2011 - Page Visibility API Polyfill
* Copyright (c) 2011 Addy Osmani
* Dual licensed under the MIT and GPL licenses.
*/
(function () {
window.visibly = {
b: null,
q: document,
@drm
drm / gist:1087457
Created July 17, 2011 11:00
Automate nano sudo
function nano() {
nano=`which nano`;
if ([ -e "$1" ] && ! [ -w "$1" ]) || ( ! [ -e "$1" ] && ! [ -w "`dirname $1`" ]); then
read -n 1 -p "$1 is not editable by you. sudo [y/N]? " y
[ "$y" == "y" ] || [ "$y" == "Y" ] && echo -e "\n" && sudo $nano $@
else
$nano $@
fi
}
@josiahcarlson
josiahcarlson / redis_simple_chat.py
Created June 24, 2011 22:07
A way of implementing a poll-based chat inside Redis
'''
redis_simple_chat.py
Written June 24, 2011 by Josiah Carlson
Released under the GNU GPL v2
available: http://www.gnu.org/licenses/gpl-2.0.html
Other licenses may be available upon request.
@a2800276
a2800276 / nodecamp.eu-talks-2011.md
Created June 14, 2011 04:37 — forked from fhemberger/nodecamp.eu-talks-2011.md
A collection of talks and presentations held at nodecamp.eu 2011
@Janiczek
Janiczek / ProjectEuler.coffee
Created May 31, 2011 21:57
First few Project Euler problems solved in CoffeeScript. Comments on how to make it more beautiful (in terms of CoffeeScript, not algorithm) highly appreciated!
@_1 = ->
# sum of multiples of 3 or 5 (not both) under 1K
answer = 0
for n in [1...1000]
if n % 3 == 0 or n % 5 == 0
answer += n
@ezzatron
ezzatron / clean-use.php
Created May 9, 2011 12:10
Script to clean unnecessary PHP use statements
#!/usr/bin/env php
<?php
$paths = array();
if (isset($_SERVER['argv']))
{
$paths = $_SERVER['argv'];
array_shift($paths);
if (!$paths)
@casualjim
casualjim / resque.scala
Created March 17, 2011 17:40
A resque implementation in scala with akka actors and scala-redis
package com.mojolly.backchat
package redis
package resque
import com.mojolly.backchat.redis.resque.Resque.{ResqueWorkerActor}
import net.liftweb.json._
import JsonAST._
import JsonDSL._
import java.net.InetAddress
import com.redis.ds.{ RedisDeque, RedisDequeClient }