Skip to content

Instantly share code, notes, and snippets.

View cyril's full-sized avatar
🌶️
I like spicy pad thai

Cyril Kato cyril

🌶️
I like spicy pad thai
View GitHub Profile
@endolith
endolith / Has weird right-to-left characters.txt
Last active April 30, 2024 12:48
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@dahlia
dahlia / lisp.rb
Created September 2, 2010 07:52
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
@netzpirat
netzpirat / 0_README.md
Created November 12, 2010 10:42
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard
@tenderlove
tenderlove / person_test.rb
Created February 10, 2011 23:10
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
end
require "twitter"
require "sunlight"
data_pos = DATA.pos
last_id = DATA.read.to_s[/\d+/]
last_id = last_id.to_i if last_id
DATA.reopen(__FILE__, "a+")
Twitter.configure do |config|
@dhh
dhh / gist:981520
Created May 19, 2011 19:27
bulk api
# Bulk API design
#
# resources :posts
class PostsController < ActiveController::Base
# GET /posts/1,4,50,90
# post_url([ @post, @post ])
def show_many
@posts = Post.find(params[:ids])
end
@robcthegeek
robcthegeek / user.rb
Created November 9, 2011 21:32
"Standard" User Model Using Mongoid/BCrypt
require 'bcrypt'
class User
include Mongoid::Document
include Mongoid::Timestamps
include BCrypt
attr_accessor :password, :password_confirmation
attr_protected :password_hash
@gabrielstuff
gabrielstuff / reset_db_password.sh
Created November 19, 2011 11:36
This little snippet helps to reset mysql root password
$ ps -ax
$ #Kill all the related mysql process and direct run the next lines#
$ sudo /usr/local/mysql/bin/mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
#direct log after execute bellow command#
$ mysql -u root
mysql > database mysql;
@drnic
drnic / Guardfile
Created April 5, 2012 06:45
An example Guardfile with the works for a Rails app
guard 'rspec', :version => 2 do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
@ahawkins
ahawkins / web_object.rb
Created May 11, 2012 14:04
My take on ActiveResource using OpenStruct delegating to a HTTP class.
module RadiumIo
class WebObject < OpenStruct
def initialize(attrs = {}, &block)
super
yield self if block_given?
end
def self.create(attributes = {}, &block)
account = new attributes, &block
account.save