Skip to content

Instantly share code, notes, and snippets.

/* Eric Meyer's CSS Reset Stylesheet */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
GREEN="\[\033[0;32m\]"
NC='\e[0m'
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'
}
PS1="\W$NC $GREEN\$(parse_git_branch)$NC$ "
.js-enabled,
html.js .js-disabled {
display:none;
}
html.js .js-enabled,
.js-disabled {
display:block;
}
My Git Workflow starting from master and doing development in a feature branch.
1) git checkout -b new_feature_name
2) make changes
3) git add .
4) git commit -m "message"
5) repeat 2-4 until you're happy with your progress
6) (optional) git rebase --interactive (if you want to cleanup the commit history prior to merge)
7) git checkout master
8) git pull
<html>
<head>
<script type="text/javascript">
jQuery(function($){
//tested
$('script.html_script').each(function() {
$(this).replaceWith($(this).text());
});
});
</script>
require 'net/http'
module Net
class HTTP
def self.terminating_url(url)
redirect_chain(url)[-1]
end
def self.redirect_chain(url)
url = URI.parse(url) unless url.is_a?(URI::HTTP)
@mikelikesbikes
mikelikesbikes / some.feature
Created November 30, 2010 15:00
form_steps.rb
Then /^I should see "([^"]*)" with the following options:$/ do |element, table|
within(element) do |content|
table.hashes.each do |row|
content.should have_selector("option", :value => row['value'], :content => row['option'])
end
end
end
function optimized_sin(x) {
while(x <= -2*Math.PI || x >= 2*Math.PI) {
if(x < 0) {
x += 2*Math.PI;
} else {
x -= 2*Math.PI;
}
}
return Math.sin(x);
}
// current window.location = "http://example.com/page"
var action = "http://example.com/beep#/stuff"
var params = "foo=bar&baz=qux"
window.location = action + encodeURIComponent("?" + params);
// browser result
// => http://example.com/beep?foo=bar&baz=qux#/stuff
// desired result