Skip to content

Instantly share code, notes, and snippets.

View gotjosh's full-sized avatar
🎯
Focusing

gotjosh gotjosh

🎯
Focusing
View GitHub Profile
@jodosha
jodosha / gist:ade11746700fe23cd4f2
Last active August 29, 2015 14:01
Lotus application structure
# app/
# controllers/
# dashboard_controller.rb DashboardController::Index or Controllers::Dashboard::Index
# identity_controller.rb IdentityController::Edit|Update or Controllers::Identity::Edit|Update
# sessions_controller.rb SessionsController::New|Create|Destroy or Controllers::Sessions::New|Create|Destroy
# entities/
# account.rb Account
# identity.rb Identity
# person.rb Person
# interactors/
@BiggerNoise
BiggerNoise / assign_case_command.rb
Created March 3, 2014 21:10
Command Pattern at work
class AssignCaseCommand < Command
attribute :case, Case
attribute :owner, User
attribute :created_by, User
attribute :comments, String
attribute :distribute_at, DateTime
attribute :distribute_rule_name, String
attribute :require_initial, Boolean
@elpargo
elpargo / gist:5753520
Created June 10, 2013 23:57
Como sobrevivir en devdom
- si el post original dice "mejor" skip it.
- si dice offtopic you should read it.
- si dije java y .net en la misma oracion skip it.
- Si melvyn arranco el post skip it.
- If it has more than 50 replies skip it.
- if marmolejos answered first skip it.
- if Orly quotes the rules skip it.
- if it contains php next, probably not worth it.
- si dice morrison, dodo o software libre skip it.
@iHiD
iHiD / config.rb
Last active June 10, 2017 15:05
Baruco 2014 Live Coding Talk on Propono.
require 'propono'
Propono.config do |config|
config.access_key = "AKIAIPE2MSOM5ZFGQBCQ"
config.secret_key = "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"
config.queue_region = "eu-west-1"
end
require 'twitter'
@twitter = Twitter::REST::Client.new do |config|
config.consumer_key = "OG9Zkag09onRe7b5ZLecO7HGb"
@lawrencejones
lawrencejones / matrixMultiply.ast
Created November 24, 2017 16:53
Matrix multiplication AST from Wacc source code
Program
[]
[ Declare
(ArrayType (ArrayType (Type "int")))
(Ident "A")
(ArrayLit
[ ArrayLit [ Unary (Op "-") (IntLit 2) , IntLit 5 ]
, ArrayLit [ IntLit 3 , IntLit 7 ]
])
, Declare
@mrdanadams
mrdanadams / application.js
Created March 28, 2012 20:41
Updating a DIV with partials after remote AJAX form submit in Rails 3
$(function() {
/* Convenience for forms or links that return HTML from a remote ajax call.
The returned markup will be inserted into the element id specified.
*/
$('form[data-update-target]').live('ajax:success', function(evt, data) {
var target = $(this).data('update-target');
$('#' + target).html(data);
});
});
@jodosha
jodosha / Gemfile
Last active December 9, 2020 15:09
Full stack Lotus application example
source 'https://rubygems.org'
gem 'rake'
gem 'lotus-router'
gem 'lotus-controller'
gem 'lotus-view'
group :test do
gem 'rspec'
gem 'capybara'
@gmodarelli
gmodarelli / pre-commit
Last active December 7, 2021 11:20
RuboCop with git pre-commit
#!/bin/sh
#
# Check for ruby style errors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
NC='\033[0m'
if git rev-parse --verify HEAD >/dev/null 2>&1

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

@yctay
yctay / figaro-capistrano.rb
Created April 30, 2013 05:34
Capistrano recipe for deploying figaro's application.yml
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
transfer :up, "config/application.yml", "#{shared_path}/application.yml", :via => :scp
end
desc "Symlink application.yml to the release path"
task :finalize do
run "ln -sf #{shared_path}/application.yml #{release_path}/config/application.yml"
end