Skip to content

Instantly share code, notes, and snippets.

View GiaoGiaoCat's full-sized avatar
👀
正在複製你的代碼

Victor Wang GiaoGiaoCat

👀
正在複製你的代碼
  • China
View GitHub Profile
@bmarini
bmarini / default.vcl.pl
Created June 30, 2011 18:01
A good varnish config for a Rails app
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
# from the cache for up to 1 hour.
# 2. Varnish will pass X-Forwarded-For headers through to the backend
# 3. Varnish will remove cookies from urls that match static content file
# extensions (jpg, gif, ...)
@jpantuso
jpantuso / osx_lion_rail_setup.md
Created July 27, 2011 19:51
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@bkimble
bkimble / gist:1365005
Last active May 2, 2024 01:27
List local memcached keys using Ruby
#!/usr/bin/env ruby
# List all keys stored in memcache.
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place.
require 'net/telnet'
headings = %w(id expires bytes cache_key)
rows = []
@nazgob
nazgob / ctags.setup
Created January 6, 2012 13:44
ctags setup on mac
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
@szimek
szimek / presentation.md
Created January 24, 2012 09:51
HTTP caching in Rails

HTTP caching

Kinds of caches

  • Browser
  • Proxy
  • Gateway

TODO Difference between proxy and gateway caches.

@ContrarySheep
ContrarySheep / rvm-coderunner.md
Created March 30, 2012 15:24
RVM gemsets and Coderunner

Coderunner is an app for OSX that makes it easy to run quick bits of code in a variety of languages. It is perfect for someone just experimenting with a particular language. For working with Ruby, I like to use RVM not only use different versions of Ruby, but also to create very specific gemsets. Getting this functionality to work with Coderunner proved a bit of challenge as the documentation is lacking, so I thought I would post the steps I took.

In this example, I will go through the setting up of a RVM environment for Ruby 1.8.7-p357 with a gemset called "my-gemset". I have already created the gemset for this example using the rvm 1.8.7@my-gemset --create command. It is important to note that the RVM environment must be configured prior to applying the settings to Coderunner.

With the RVM environment setup, the next thing to do is open up the Coderunner preferences and look at the languages. There are quite a few

@sandys
sandys / etc_monit_conf.d_localhost
Created May 4, 2012 12:59
secure and self contained ruby deployment with multiple load-balanced, boot-persistent and highly available thin servers, and a multi-user rvm environment
set httpd port 2812 and # Monit will run on port 2812
allow sss:sss123 #set your username and password to loin to your Monit
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 23, 2024 05:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jjb
jjb / gist:3237811
Created August 2, 2012 15:13
List an ActiveRecord model's callbacks
self.class._create_callbacks.select { |callback| callback.kind.eql?(:after) }.collect(&:filter)
@roberto
roberto / _flash_messages.html.erb
Created August 13, 2012 22:47
Rails flash messages using Twitter Bootstrap
<% flash.each do |type, message| %>
<div class="alert <%= bootstrap_class_for(type) %> fade in">
<button class="close" data-dismiss="alert">×</button>
<%= message %>
</div>
<% end %>