Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)
First one found from of
require 'active_support' | |
module CRUDActions | |
extend ActiveSupport::Concern | |
included do | |
before_action :set_resource, only: [:show, :update, :destroy] | |
end | |
# Returns count of records matching the scope | |
def count |
#!/usr/bin/env bash | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until the script has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
install_thoughtbot() { | |
mkdir -p "$HOME/installer/logs" && cd "$HOME/installer" |
/*================================================== | |
= Bootstrap 3 Media Queries = | |
==================================================*/ | |
/*========== Mobile First Method ==========*/ | |
/* Custom, iPhone Retina */ | |
@media only screen and (min-width : 320px) { | |
} |
# 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 |
L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs
sudo touch /etc/apt/sources.list.d/pgdg.list | |
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list | |
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
sudo apt-get update | |
sudo apt-get -y install postgresql-9.3 libpq-dev postgresql-contrib-9.3 | |
sudo apt-get autoremove | |
sudo pg_dropcluster --stop 9.3 main | |
sudo pg_createcluster --start -e UTF-8 9.3 main |
// backbone collections lack a search functionality. This adds it to all collections. | |
// fuse.js is the library that powers the fuzzy search and requires being downloaded and included into your app | |
// http://kiro.me/projects/fuse.html | |
_.extend(Backbone.Collection.prototype, { | |
searchableFields: null, | |
buildSearchIndex: function(options) { | |
options = (typeof options !== 'undefined') ? options : {}; |
/** | |
* Retrieves all the rows in the active spreadsheet that contain data and logs the | |
* values for each row. | |
* For more information on using the Spreadsheet API, see | |
* https://developers.google.com/apps-script/service_spreadsheet | |
*/ | |
function readRows() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var rows = sheet.getDataRange(); | |
var numRows = rows.getNumRows(); |
# http://stackoverflow.com/questions/4397412/read-edit-and-write-a-text-file-line-wise-using-ruby | |
# files = Dir.glob(File.dirname(__FILE__)+"/../app/**/*.rb") | |
files = Dir[Rails.root.join("app", "**/*.rb")] | |
files.each do |f_name| | |
# puts f_name | |
File.open(f_name, "r+") do |f| | |
old_pos = 0 | |
f.each do |line| |