Skip to content

Instantly share code, notes, and snippets.

@stuart11n
stuart11n / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@suryart
suryart / application.html.erb
Last active October 26, 2023 00:16
Rails 4 flash messages using Twitter Bootstrap(bootstrap-sass: https://github.com/thomas-mcdonald/bootstrap-sass). An improved version of https://gist.github.com/roberto/3344628
// layout file
<body>
<div class="container">
<%= flash_messages %>
<%= yield %>
</div><!-- /container -->
</body>
@jehrhardt
jehrhardt / .zshrc
Last active October 9, 2016 07:23
# oh-my-zsh location
ZSH=$HOME/.oh-my-zsh
# Use lambda theme
ZSH_THEME="robbyrussell"
# Use plugins for typical tools
plugins=(brew git)
# Load oh-my-zsh
@willurd
willurd / web-servers.md
Last active May 25, 2025 11:13
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@snipe
snipe / googleform2email
Last active November 16, 2017 21:37
Script to get the contents of a Google form submission emailed to you.
function sendFormByEmail(e)
{
// Remember to replace this email address with your own email address
var email = "[email protected]";
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var message = "";
var subject = "New Hire: ";
@halloffame
halloffame / RubyDateFormats.md
Last active May 18, 2025 04:43
Quick reference for ruby date format abbreviations.

Date

Year

%Y - Year with century (can be negative, 4 digits at least) -0001, 0000, 1995, 2009, 14292, etc.

  • %C - year / 100 (round down. 20 in 2009)
  • %y - year % 100 (00..99)
@nulltask
nulltask / apache.rb
Created March 28, 2012 08:01
parsing apache access log with ruby
#!/usr/bin/env ruby
require 'rubygems'
require 'apache_log_regex'
require 'date'
format = '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"'
parser = ApacheLogRegex.new(format)
File.readlines('/path/to/access-log').collect do |line|
@eThikas
eThikas / ttfb.rb
Created March 22, 2012 15:46
Continuously measure 'Time To First Byte'. Easily plot Connection and TTFB
#!/usr/bin/env ruby
#
# @Name TTFB Measurer
# @Author Rasmus Christiansen
# @Description
#
# Measures the "true" loading time of a website.
# Saves data output to an .out-file
# Saves additional .conn and .ttfb files for easy plotting