Skip to content

Instantly share code, notes, and snippets.

View kidbrax's full-sized avatar

Braxton Beyer kidbrax

View GitHub Profile
@markoa
markoa / capistrano-with-bundler-deploy.rb
Created March 15, 2011 11:18
The snippet for config/deploy.rb to use Bundler.
# use this in a after "deploy:update_code" block
namespace :bundler do
task :create_symlink, :roles => :app do
shared_dir = File.join(shared_path, 'bundle')
release_dir = File.join(current_release, '.bundle')
run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}")
end
task :bundle_new_release, :roles => :app do
@rtekie
rtekie / cap_notify.rb
Created April 2, 2011 16:16
Capistrano deployment email notifier for Rails 3
=begin
Capistrano deployment email notifier for Rails 3
Do you need to send email notifications after application deployments?
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html.
Here is Rails 3 port of the notifier.
The notifier sends an email after application deployment has been completed.
@bdwong
bdwong / configure.patch
Created April 6, 2011 19:14
Patch to SWIG 2.0.2 to make it build with rvm under Mac OS 10.6
--- configure 2011-02-20 12:24:48.000000000 -0800
+++ configure.mine 2011-03-29 15:46:00.000000000 -0700
@@ -8654,15 +8654,20 @@
RUBYDIR=`($RUBY -rmkmf -e 'print Config::CONFIG["archdir"] || $archdir') 2>/dev/null`
if test x"$RUBYDIR" != x""; then
- dirs="$RUBYDIR"
- RUBYINCLUDE=none
+ # dirs for rvm
+ dirs="`cd $MY_RUBY_HOME/include/*/*/ruby/..;pwd` `cd $MY_RUBY_HOME/include/*;pwd`"
+ RUBYINCLUDE=""
@chanmix51
chanmix51 / app.nginx.conf
Created August 17, 2011 08:45
nginx vhost conf silex & symfony
server {
listen 80;
server_name server.mydomain.net
root /var/www/app/web;
index index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
@aheckmann
aheckmann / mongoose_with_mongo2-2_elemMatch_projection.js
Created September 5, 2012 17:31
using the $elemMatch projection with mongoose
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var assert = require('assert')
console.log('\n===========');
console.log(' mongoose version: %s', mongoose.version);
console.log('========\n\n');
var dbname = 'testing_1085';
mongoose.connect('localhost', dbname);
@ampedandwired
ampedandwired / template.rb
Last active August 26, 2020 03:43
Splitting cfndsl templates into multiple files
require_relative "subtemplate.rb"
CloudFormation {
instance_type = external_parameters.fetch(:instance_type, "t2.micro")
my_instance(instance_type)
}
@kurko
kurko / spec_helper.rb
Created February 29, 2012 21:37
Sunspot with RSpec
#inside RSpec.configure
config.before :all do
SunspotTest.stub
end
config.before(:all, search: true) do
SunspotTest.setup_solr
Sunspot.remove_all!
Sunspot.commit
@totomz
totomz / send-to-cloudwatch.sh
Last active September 11, 2023 08:37
A simple script to push a JSON log to AWS CLoudWatch
#!/bin/bash
AWS_REGION="--region XXX_REGION"
AWS_PROFILE="--profile XXX_PROFILE"
LOG_GROUP="XXX_YOUR_LOG_GROUP"
LOG_STREAM="$(whoami)-$( date "+%Y%m%d-%H-%M-%S")"
aws logs create-log-stream --log-group-name $LOG_GROUP --log-stream-name $LOG_STREAM $AWS_REGION $AWS_PROFILE
@metaskills
metaskills / wait_until.rb
Last active October 20, 2023 13:08
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active March 6, 2024 18:14
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"