-
Install XCode
-
Install Command Line Tools from XCode Preferences
-
Install Homebrew
-
Install rvm or rbenv
-
Install Matterhorn dependencies within Homebrew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#------------------------------------------------------------------------------ | |
# Aggregate Print useful information from /proc/[pid]/smaps | |
# | |
# pss - Roughly the amount of memory that is "really" being used by the pid | |
# swap - Amount of swap this process is currently using | |
# | |
# Reference: | |
# http://www.mjmwired.net/kernel/Documentation/filesystems/proc.txt#361 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'reloader/sse' | |
class ProgressController < ApplicationController | |
include ActionController::Live | |
def index | |
# SSE expects the `text/event-stream` content type | |
response.headers['Content-Type'] = 'text/event-stream' | |
sse = Reloader::SSE.new(response.stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AttachmentCtrl($scope, $location, $timeout, Docs) { | |
$(function() { | |
$('#detail-form-doc').fileupload({ | |
dataType: 'json', | |
url: '/angular-ib/app/fileupload?id=' + $location.search().id, | |
add: function(e, data) { | |
$scope.$apply(function(scope) { | |
// Turn the FileList object into an Array | |
for (var i = 0; i < data.files.length; i++) { | |
$scope.project.files.push(data.files[i]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html ng-app="project"> | |
<head> | |
<title>Angular: Service example</title> | |
<script src="http://code.angularjs.org/angular-1.0.1.js"></script> | |
<script> | |
var projectModule = angular.module('project',[]); | |
projectModule.factory('theService', function() { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Provide varbinary columns in a Migration. | |
# Probably a better way to do this? | |
# | |
# Usage: | |
# => t.varbinary :column, :limit => 20, ....[options] | |
# | |
ActiveRecord::ConnectionAdapters::SchemaStatements.module_eval do | |
def type_to_sql_with_varbinary(type, limit = nil, precision = nil, scale = nil) | |
return type_to_sql_without_varbinary(type, limit, precision, scale) unless :varbinary == type.to_sym |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It appears that when I perform a query with AR via multiple threads, | |
# the instantiated objects do not get released when a GC is performed. | |
threads = Array.new(5) { Thread.new { Foo.where(:status => 2).all.first(100).each { |f| f.owner.first_name } } } | |
threads.each(&:join) | |
threads = nil | |
GC.start | |
ObjectSpace.each_object(Foo).count # => instances still exist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream myapp { | |
server unix:///myapp/tmp/puma.sock; | |
} | |
server { | |
listen 80; | |
server_name myapp.com; | |
# ~2 seconds is often enough for most folks to parse HTML/CSS and | |
# retrieve needed images/icons/frames, connections are cheap in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is the structure of the binary nbt file | |
TAG_Compound('Level') { | |
TAG_Compound('nested compound test') { | |
TAG_Compound('egg') { | |
TAG_String('name'): 'Eggbert' | |
TAG_Float('value'): 0.5 | |
} | |
TAG_Compound('ham') { | |
TAG_String('name'): 'Hampus' | |
TAG_Float('value'): 0.75 |
http://guides.rubyonrails.org/migrations.html
- add_column
- add_index
- change_column
- change_table
- create_table
- drop_table