Skip to content

Instantly share code, notes, and snippets.

@nicolai86
nicolai86 / ansible-rails example
Created February 12, 2014 06:11
a current usage example for nicolai86.rails-deployment as of v0.6.0
---
- hosts: server
user: app_user
gather_facts: False
vars:
user: app_user
home_directory: "/home/{{ user }}"
deploy_to: "{{ home_directory }}/app"
roles:
@zenlor
zenlor / Backbone.reqwest.js
Created September 21, 2011 14:39
Backbone.js Sync method for reqwest.js and Ender.js
(function (reqwest, Backbone) {
var methodMap, getUrl;
methodMap = {
'create': 'POST',
'update': 'PUT',
'delete': 'DELETE',
'read' : 'GET'
};
getUrl = function(object) {
# > Note 1: Yes, the parenthesis `( )`` for the prepend call are required when
# > using this inline style. If you do not use the parenthesis it will fail
# > silently and the patch will not be applied.
# -- https://solidfoundationwebdev.com/blog/posts/writing-clean-monkey-patches-fixing-kaminari-1-0-0-argumenterror-comparison-of-fixnum-with-string-failed
#
# The code below will show what's happening in this line of code from the blog:
#
# prepend(KaminariFix = Module.new do
# ...
# end)
@subelsky
subelsky / asset.rake
Created March 3, 2013 21:48
Quick rake task to check if assets need to pre-compiled before deployment (since I don't like precompiling during deployment)
namespace :assets do
task :check do
root_dir = File.join(File.dirname(__FILE__),"..","..")
assets_last_modified_at = Dir["#{root_dir}/app/assets/**/**"].map { |p| File.mtime(p) }.sort.last
assets_last_compiled_at = Dir["#{root_dir}/public/assets/**/**"].map { |p| File.mtime(p) }.sort.last
if assets_last_modified_at > assets_last_compiled_at
fail "Assets need to precompiled; last asset modified at #{assets_last_modified_at}"
end
end
@sjl
sjl / zl.vim
Created January 17, 2014 17:46
Zip Right Vim mapping
" Zip Right
"
" Moves the character under the cursor to the end of the line. Handy when you
" have something like:
"
" foo
"
" And you want to wrap it in a method call, so you type:
"
" println()foo
@rstormsf
rstormsf / bedrock-ansible-setup.sh
Last active January 29, 2018 10:23
Bedrock ansible setup
#!/bin/bash
#Script to install Bedrock Wordpress stack on OSX
brew doctor
brew tap caskroom/cask
brew update && brew upgrade brew-cask && brew cleanup && brew cask cleanup
brew cask install virtualbox vagrant
brew install rbenv ruby-build
#use bashrc if you are not on zsh
cat >> ~/.zshrc << EOF
# ###
@quirkey
quirkey / console_helpers.rb
Last active February 13, 2020 19:57
All the code for the Paperless Profiler
require 'rblineprof'
module Rblineprof
module ConsoleHelpers
include Rblineprof::Helpers
def lineprof_block(options = {}, &block)
profile = lineprof(rblineprof_profiler_regex(options[:lineprofiler])) do
ret = yield
end
@bennylope
bennylope / ansible.yml
Created April 30, 2014 00:35
Deployment w/ Capistrano style deployments with Ansible & Capistrano
---
- name: Deploy new site release
user: deployer
hosts: all
tasks:
- name: Fetch repo updates
git: >
repo=git@github.com:my/repo.git
@jmather
jmather / deploy.rb
Created September 13, 2012 16:25
Spiffy capistrano config for composer based projects
after "deploy", "deploy:cleanup"
after "deploy:update_code", "composer:install"
before "composer:install", "composer:copy_vendors"
after "composer:install", "phpunit:run_tests"
namespace :composer do
desc "Copy vendors from previous release"
task :copy_vendors, :except => { :no_release => true } do
run "if [ -d #{previous_release}/vendor ]; then cp -a #{previous_release}/vendor #{latest_release}/vendor; fi"
end
@joelhooks
joelhooks / gear.md
Last active June 14, 2021 08:45
Podcasting Gear List