Shell snippet that prepends a nice to a command's output.
For example, here's the (snipped) output of vagrant provision
:
Successfully installed bundler-1.3.5
1 gem installed
Using rmagick (2.13.2)
unicorn.rb | |
----------------------------------- | |
application = "jarvis" | |
remote_user = "vagrant" | |
env = ENV["RAILS_ENV"] || "development" | |
RAILS_ROOT = File.join("/home", remote_user, application) | |
worker_processes 8 | |
timeout 30 |
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
module ActiveRecord | |
class Migrator | |
class << self | |
def get_all_versions | |
table = Arel::Table.new(schema_migrations_table_name) | |
# must not be Base.establish_connection b/c that'll drop the mysql2 | |
# adapter connection and blow up rake db:schema:dump | |
SchemaMigration.establish_connection(ActiveRecord::Base.configurations['cluster'][Rails.env]) | |
cluster_migrations = SchemaMigration.connection.select_values(table.project(table['version'])).map{ |v| v.to_i } |
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
my $body = <<"EOM"; | |
<html> | |
<head> | |
<title>title</title> | |
</head> |
ACTION | |
AD_HOC_CODE_SIGNING_ALLOWED | |
ALTERNATE_GROUP | |
ALTERNATE_MODE | |
ALTERNATE_OWNER | |
ALWAYS_SEARCH_USER_PATHS | |
ALWAYS_USE_SEPARATE_HEADERMAPS | |
APPLE_INTERNAL_DEVELOPER_DIR | |
APPLE_INTERNAL_DIR | |
APPLE_INTERNAL_DOCUMENTATION_DIR |
# Load DSL and Setup Up Stages | |
require 'capistrano/setup' | |
# Includes default deployment tasks | |
require 'capistrano/deploy' | |
# Custom tasks | |
require 'capistrano/composer' | |
require 'capistrano/npm' |
.text-xs-left { text-align: left; } | |
.text-xs-right { text-align: right; } | |
.text-xs-center { text-align: center; } | |
.text-xs-justify { text-align: justify; } | |
@media (min-width: @screen-sm-min) { | |
.text-sm-left { text-align: left; } | |
.text-sm-right { text-align: right; } | |
.text-sm-center { text-align: center; } | |
.text-sm-justify { text-align: justify; } |
There is a bug in Groovy version up to 2.3.7. HTTPBuilder is not able to automatically parse chunked response to JSON format. If external server returns response with header:
Transfer-Encoding : chunked
Usually applied code:
def http = new HTTPBuilder(url)
def result = http.request(POST, JSON) { req ->
require 'sneakers/runner' | |
task :environment | |
namespace :sneakers do | |
desc "Start processing jobs with all workers" | |
task :work => :environment do | |
silence_warnings do | |
Rails.application.eager_load! unless Rails.application.config.eager_load | |
end |