Skip to content

Instantly share code, notes, and snippets.

@kotay
kotay / progress.rb
Last active August 29, 2015 13:56
Progress
class Progress
def initialize(msg, total, &context)
@total = total
@context = context
end
def update(progress)
puts(progress)
end
module Plugins
def self.included(base)
base.class_eval do
include Plugin1
# include IdealPlugin doesn't work
# ...
hello("from plugins")
end
end
end
@kotay
kotay / plugins.rb
Created February 11, 2014 11:24 — forked from mikecmpbll/plugins.rb
module Plugin1
hello("hello")
end
module PluginContainer
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
include Plugin1
@kotay
kotay / spinner.rb
Last active August 29, 2015 13:56
ruby console spinner
def with_spinner
finished = false
working = Mutex.new
spinner = Thread.new do
loop do
break if working.synchronize {finished}
["|","/","-","\\"].each do |glyph|
print "\r#{glyph}"
sleep 0.07
print "\b"
@kotay
kotay / README.md
Last active October 2, 2015 14:50 — forked from widged/README.md
Quick coloring book in SVG
@kotay
kotay / paginate.scss
Created July 22, 2013 15:33
a will_paginate css
.pagination{
float:right;
margin-top: 7px;
height: 22px;
line-height: 22px;
span, a, em{
text-decoration:none;
padding: 4px 7px;
border-top: 1px solid #E2E2E2;
border-left: 1px solid #C9C9C9;
@kotay
kotay / 0_reuse_code.js
Last active January 2, 2016 16:39
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kotay
kotay / rails_resources.md
Created January 9, 2014 09:55 — forked from jookyboi/rails_resources.md
Rails-related Gems and guides to accelerate your web project.

Gems

  • Bundler - Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
  • rabl - General ruby templating with json, bson, xml, plist and msgpack support
  • Thin - Very fast and lightweight Ruby web server
  • Unicorn - Unicorn is an HTTP server for Rack applications designed to only serve fast clients on low-latency, high-bandwidth connections and take advantage of features in Unix/Unix-like kernels.
  • SimpleCov - SimpleCov is a code coverage analysis tool for Ruby 1.9.
  • Zeus - Zeus preloads your Rails app so that your normal development tasks such as console, server, generate, and specs/tests take less than one second.
  • [factory_girl](h
@kotay
kotay / Gemfile
Created July 21, 2016 09:31 — forked from chocnut/Gemfile
iOS AC + Social(Facebook) Framework & Rails(omniauth-facebook)
gem 'devise'
gem 'omniauth-facebook'
IOS_DEVICES = {
'iPhone1,1' => 'iPhone 1G',
'iPhone1,2' => 'iPhone 3G',
'iPhone2,1' => 'iPhone 3GS',
'iPhone3,1' => 'iPhone 4',
'iPhone3,3' => 'iPhone 4 (Verizon)',
'iPhone4,1' => 'iPhone 4S',
'iPhone5,1' => 'iPhone 5 (GSM)',
'iPhone5,2' => 'iPhone 5 (GSM+CDMA)',
'iPhone5,3' => 'iPhone 5C (GSM)',