Skip to content

Instantly share code, notes, and snippets.

View adamaiken89's full-sized avatar
๐Ÿ˜€
happy

Adam Aiken adamaiken89

๐Ÿ˜€
happy
  • Hong Kong
  • 23:34 (UTC +08:00)
  • LinkedIn in/adamhk
View GitHub Profile
@timcheadle
timcheadle / README.md
Last active January 26, 2023 00:56
Make /robots.txt aware of the Rails environment

Make /robots.txt aware of the Rails environment

You probably don't want Google crawling your development staging app. Here's how to fix that.

$ mv public/robots.txt config/robots.production.txt
$ cp config/robots.production.txt config/robots.development.txt

Now edit config/routes.rb to add a route for /robots.txt, and add the controller code.

@le0pard
le0pard / gist:2521687
Created April 28, 2012 20:01
Generate digital signature for image on ruby and compare
require 'RMagick'
require 'yaml'
class ImageDiff
#max = 20
MATRIX = 15
def generate_array(image_path)
result = []
@Jach
Jach / sieve.py
Created February 7, 2012 18:43
Incremental Sieve of Eratosthenes
'''
Python implementation of Haskell's
sieve xs = sieve' xs Map.empty
where
sieve' [] table = []
sieve' (x:xs) table =
case Map.lookup x table of
Nothing -> x : sieve' xs (Map.insert (x*x) [x] table)
Just facts -> sieve' xs (foldl reinsert (Map.delete x table) facts)
@rjungemann
rjungemann / redis_pubsub.rb
Created May 24, 2010 22:04
A Redis pubsub example for Ruby
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
# http://gist.github.com/348262
# Incomplete evented Redis implementation specifically made for
# the new PubSub features in Redis.
# Modifications by Roger Jungemann
require 'stringio'