Skip to content

Instantly share code, notes, and snippets.

View tanraya's full-sized avatar

Andrew Kozlov tanraya

  • Astana, Kazakhstan
View GitHub Profile
@peterc
peterc / gist:33337
Created December 8, 2008 03:42
Fully featured Rails template (for Rails 2.3)
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
@jodosha
jodosha / bench_results.txt
Created February 6, 2009 21:58
Lightweight implementation of ActiveSupport::Callbacks (no backward compatibilities)
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
test | old | new | boost
SymbolCallbackPerson | 0.418285131454468 | 0.198039770126343 | 2.11x
ProcCallbackPerson | 0.478709936141968 | 0.309146881103516 | 1.55x
MethodCallbackPerson | 0.298830032348633 | 0.114556074142456 | 2.60x
StringCallbackPerson | 0.782155990600586 | 0.653557062149048 | 1.97x
ObjectCallbackPerson | 0.49412202835083 | 0.30273699760437 | 1.63x
ConditionalPerson | 5.81794190406799 | 5.45951700210571 | 1.07x
@endolith
endolith / Has weird right-to-left characters.txt
Last active June 1, 2024 10:58
Unicode kaomoji smileys emoticons emoji
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@Sutto
Sutto / deploy.rake
Created January 16, 2010 08:40
Super Simple Git, Bundler and Unicorn deploys
namespace :deploy do
def config(key)
(@config ||= YAML.load_file("config/deploy.yml").symbolize_keys)[key.to_sym]
end
# Hooks as needed
task :local_before do
end
namespace :sass do
desc 'Updates stylesheets if necessary from their Sass templates.'
task :update => :environment do
sh "rm -rf public/stylesheets/compiled tmp/sass-cache"
Sass::Plugin.options[:never_update] = false
Sass::Plugin.update_stylesheets
end
end
@lwille
lwille / application_helper.rb
Created March 4, 2010 22:46
Single DB query tree generation with awesome_nested_set
module ApplicationHelper
# Mixin for tree generation based on a nested set, just place this in your application_helper.rb
module TreeMethods
attr_accessor :child_nodes
attr_accessor :parent_node
def after_initialize
@child_nodes = []
@parent_node = nil
end
def recursive_tree nodes=nil, level=0
@serek
serek / application_helper.rb
Created April 8, 2010 08:26
Polymorphic file upload with paperclip, delayed_job, has_many_polymorphs, swfupload, formtastic and haml. Make same for any other types like Image, Audio, Document and so on.
module ApplicationHelper
# Access Levels
ACCESS_LEVELS = { :private => 0, :friends => 1, :public => 2 }
# Access levels i18n translation
def access_levels
ACCESS_LEVELS.collect{|k,v| [I18n.t("access." + k.to_s), v]}
end
end
@lucashungaro
lucashungaro / links.textile
Created August 14, 2010 16:36
Links de referência utilizados em minha palestra
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SoundCloud OAuth 2 User Agent Authentication Flow Demo</title>
<script type="text/javascript" charset="utf-8" src="javascript/jquery-1.4.2.js"></script>
<script type="text/javascript" charset="utf-8">
$(function () {
var extractToken = function(hash) {