Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View coffeencoke's full-sized avatar

Matt Simpson coffeencoke

View GitHub Profile
@coffeencoke
coffeencoke / gist:8201402
Created December 31, 2013 19:48
Why does this happen?
"'this has quotes'".gsub("'", "\\'") # => "this has quotes'this has quotes"
@coffeencoke
coffeencoke / fetch_all.rb
Last active December 18, 2015 10:39
Fetch all repositories in my Projects directory
require 'grit'
Grit.debug = true # to show when remotes could not be fetched in STDOUT
files = Dir.glob(File.join("**", ".git"))
files.each do |f|
dir = File.expand_path "../", f
puts "Fetching #{dir}"
r = Grit::Repo.new dir
r.remote_fetch 'origin', timeout: false # Use https://github.com/coffeencoke/grit/tree/pass_options_to_fetch

Entry

  • Passion
    • Wants to learn
    • Eager to learn
  • Aptitude
    • Can learn a new language with little help
  • Understands basics to a Language
  • Language comprehension
@coffeencoke
coffeencoke / README.md
Last active May 19, 2017 08:02
Use a sub directory as a rails application's url root rails 3, nginx, unicorn

Symlink for static files

Among applying the changes in the other files in this gist, you need to symlink the directory you are serving the app with in the root app's public directory so that NGINX can serve the static files in the sub-app.

For example, if you have an app at /home/coffeencoke/apps/app.coffeencoke.com/current/public as your root app, and you have the sub app served at http://app.coffeencoke.com/admin, then you need to symlink /home/coffeencoke/apps/admin-app.coffeencoke.com/current/public to /home/coffeencoke/apps/app.coffeencoke.com/current/public/admin like so:

ln -s /home/coffeencoke/apps/admin-app.coffeencoke.com/current/public /home/coffeencoke/apps/app.coffeencoke.com/current/public/admin
@coffeencoke
coffeencoke / command_line.txt
Last active October 12, 2015 08:18
vim find and replace
# Just do it
find . -type f -exec sed -i '' 's/from/to/g' {} \;
@coffeencoke
coffeencoke / jenkins-nginx.conf
Created October 13, 2012 16:58
Nginx conf for redirecting jenkins
server {
listen 80; # Listen on port 80 for IPv4 requests
server_name build.yourdomain.com;
access_log /var/log/nginx/jenkins_access.log;
error_log /var/log/nginx/jenkins_error.log;
location ~ ^/static/[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]\/(.*)$ {
#rewrite all static files into requests to the root
@coffeencoke
coffeencoke / .bash_aliases
Created August 8, 2012 03:29
Linux dot files
# General Use Aliases
alias l='ls -lha'
alias ll='ls -lha'
alias c='clear'
alias cx='chmod +x'
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
# Ruby / Ruby on Rails Aliases
alias cucumber='cucumber --require features'
@coffeencoke
coffeencoke / redis-server
Created June 27, 2012 16:52
Redis init script
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /home/capistrano/path/to/app/config/redis/production.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
$(function(){
$('.subnav').fixElementOnScroll(45, 'subnav-fixed');
$('.sidebar-nav').fixElementOnScroll(113, 'fixed');
});
@coffeencoke
coffeencoke / gist:2763229
Created May 21, 2012 16:48
Install yaml when certs fail through RVM.
rvm uninstall 1.9.3
# Download http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure
make
make install
rvm install 1.9.3