Skip to content

Instantly share code, notes, and snippets.

@derryl
derryl / open_github_page.sh
Created July 31, 2013 18:02
Opens the GitHub website for the repo currently being viewed in Bash
#!/bin/sh
function gh() {
giturl=$(git config --get remote.origin.url)
if [ "$giturl" == "" ]
then
echo "Not a git repository or no remote.origin.url set"
exit 1;
fi
@derryl
derryl / vars.less
Last active December 20, 2015 06:29
Example of my pattern for naming LESS/SCSS variables
// 1. Base palette
@primaryColor: #245BB3;
@secondaryColor: #FDD33B;
@white: #EAF2FF; // "white" - actually a very light blue
// 2. Semantic elements are derived from base palette
@backgroundColor: darken( @primaryColor, 40%);
@textColor: lighten( @primaryColor, 40%);
// Establish Date ranges
var date_today = new Date.today().toString("yyyy-MM-dd");
var date_lastweek = new Date().last().week().toString("yyyy-MM-dd");
var date_twoweeks = new Date().last().week().addDays(-7).toString("yyyy-MM-dd")
// Execute this function when the 'Make API Call' button is clicked
function makeApiCall() {
// FP announce page views
var fpAnnounce = gapi.client.analytics.data.ga.get({
@derryl
derryl / gist:3988979
Created October 31, 2012 18:38
Derryl's colored prompts
# basic green prompt with teal pathname
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$ '
# green username@location + silly-looking koala
export PS1='\[\033[01;32m\]\u@\h \[\033[0m\]ʕ \[\033[01;31m\]•\[\033[0m\]ᴥ\[\033[01;31m\]•\[\033[0m\]ʔ '
# green username@location + teal pathname + red musical note
export PS1='\[\033[01;32m\]\u@\h \[\033[01;36m\]\w \[\e[1;31m\]♫ \[\033[00m\]'
# red musical note + teal pathname
@derryl
derryl / gist:3347061
Created August 14, 2012 06:54
curl function that outputs timing info
tcurl() {
curl -o /dev/null -s -w "Response code: %{http_code}\nTime to connect: %{time_connect} secs\nFirst byte received: %{time_starttransfer} secs\nTotal time: %{time_total} secs\n\n%{size_download} bytes received at %{speed_download} bytes/sec\n" --silent $1;
}
@derryl
derryl / zen_settings_snippet.py
Created August 3, 2012 19:36
A couple of Javascript snippet completions that I use in Zencoding
'zepto': '<script src="https://raw.github.com/madrobby/zepto/master/src/zepto.js"></script>',
'backbone': '<script src="https://raw.github.com/documentcloud/backbone/master/backbone-min.js"></script>',
@derryl
derryl / markdown-preview-mou.md
Created August 2, 2012 03:49 — forked from sindresorhus/markdown-preview-mou.md
How to write your Markdown in Sublime Text 2 and preview in Mou

How to write your Markdown in Sublime Text 2 and preview in Mou

I use Sublime for everything text related, but it doesn't have any built-in way to preview my Markdown files.

This is how easy it is to preview in Mou:

  • In Sublime, go to Tools -> Build System -> New Build System...
  • In the newly opened file, replace the file contents with this and save: { "osx": {
@derryl
derryl / jarTT Bookmarklet
Created April 5, 2012 00:10
jarTT Bookmarklet
javascript:(function(){$.getScript('https://raw.github.com/chrisinajar/jarTT/master/jarTT.js');})();
@derryl
derryl / ios-media-queries.sass
Created March 28, 2012 19:12 — forked from adamstac/ios-media-queries.sass
iOS Media Queries for iPhone/iPod, iPad & Retina and Non-Retina Devices
.ipad-only,
.iphone-only,
.retina-only,
.non-retina-only,
.retina-iphone-only,
.non-retina-iphone-only
display: none
// iPad Only
@media only screen and (device-width: 768px)