Skip to content

Instantly share code, notes, and snippets.

View unicornrainbow's full-sized avatar
💖
🎈Sharing codes 🔫🛍🛁📐🎉💉🕳🚬💎💰💳

Rashiki Grace unicornrainbow

💖
🎈Sharing codes 🔫🛍🛁📐🎉💉🕳🚬💎💰💳
  • Newstime
  • Daytona Beach, FL
View GitHub Profile
@unicornrainbow
unicornrainbow / gist:6415399
Last active December 22, 2015 04:09 — forked from zoras/.railsrc
.railsrc
# .railsrc for Rails 3, encoding: utf-8
# see http://rbjl.net/49-railsrc-rails-console-snippets
if !Rails.application then warn "Rails isn't loaded, yet... skipping .railsrc" else
# # #
def ripl?; defined?(Ripl) && Ripl.instance_variable_get(:@shell); end
# # #
# loggers

The understanding that finite state machines and regular expressions are functionally equivalent opens up some incredibly interesting uses for regular expression engines–particularly when it comes to creating business rules that can be changed without recompiling a system.

http://blog.markshead.com/869/state-machines-computer-science/

$ git branch -r --merged |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
awk '{split($0,a,"/"); print a[2]}' |
xargs git push origin --delete
@unicornrainbow
unicornrainbow / generate_class_diagrams_from_a_rails_project.md
Last active December 15, 2015 06:49
Generate class diagrams from a Rails 3.x project (Using Railroady)

Class Diagrams maya at time be over rated, but I find them useful to look at when first coming onto a project inorder to get a birds eye view. This is how to generate a class diagram for a Rails 3.x project on ruby 1.9.x.

Install graphviz, railroady uses it to generate the diagrams.

$ brew update && brew install graphviz

Add [roadroady][1] to your gem file. (Railroady is a follow-on to the orginal railroad gem. It works well with Rails 3.x and ruby 1.9.2. I could not get the railroad gem to work at all.)

gem "railroady"
@unicornrainbow
unicornrainbow / gist:5178491
Last active December 15, 2015 01:09
Chrome search, I'm feeling lucky
  1. Right click anywhere in the omnibar, and select "Edit Search Engines..."

  2. Create a new search engine with the following url. Name it what you like, and choose a keyword. I use "I'm Feeling Lucky" and "lucky" respectively.

    {google:baseURL}search?q=%s&{google:RLZ}{google:acceptedSuggestion}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:searchClient}{google:sourceId}{google:instantExtendedEnabledParameter}ie={inputEncoding}&btnI=1

  3. After you've created the search engine by entering all the details and leaving the form fields, scroll up to find it in the list, hover the item and select make default.

deployment:
production:
branch: master
heroku:
appname: sirinova-prod
commands:
- git push git@heroku.com:sirinova-prod.git
- heroku run rake db:migrate
- heroku restart
# 1) Running a raw RackAdapter in config.ru mounted at '/' works fine
require 'bundler/setup'
require 'yard'
run YARD::Server::RackAdapter.new(
{'surfiki' => [YARD::Server::LibraryVersion.new('surfiki', nil, File.expand_path('../.yardoc', __FILE__))]},
{
:single_library => true,
:caching => false
})
class Api::RegistrationsController < Api::BaseController
respond_to :json
def create
user = User.new(params[:user])
if user.save
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201
return
else
@unicornrainbow
unicornrainbow / unicorn.conf.rb
Created October 31, 2012 17:14 — forked from rcrowley/unicorn.conf.rb
Unicorn logging to syslog
class Syslogger
def initialize
read, @write = IO.pipe
fork do
@write.close
$stdin.reopen read
exec *%w(logger -trails)
end
read.close
@unicornrainbow
unicornrainbow / 1-appview.js
Created October 15, 2012 17:06 — forked from mxriverlynn/1-appview.js
more than just backbone constructs
AppView = Backbone.View.extend({
initialize: function(){
this.router = new AppRouter();
this.collection = new MyCollection();
this.someView = new SomeView();
this.someView.render();
Backbone.history.start();
}