Skip to content

Instantly share code, notes, and snippets.

@mars
mars / ember-data-global-ajax-params.js
Last active December 16, 2015 06:09
Add params to Ember Data's RESTAdapter AJAX requests.
App.accountId = 'asdf';
App.RESTAdapter = DS.RESTAdapter.extend({
// Scope all ajax calls.
ajax: function(url, type, hash) {
if (Ember.isEmpty(hash)) hash = {};
if (Ember.isEmpty(hash.data)) hash.data = {};
hash.data.account_id = App.accountId;
this._super(url, type, hash);
}
@mars
mars / .bash_profile
Last active October 22, 2018 21:48
bash prompt git status
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
function parse_git_dirty {
git diff --quiet || echo " ▲ "
}
function parse_git_branch {
e=`echo $( { git status; } 2>&1 ) | tr '[:upper:]' '[:lower:]'`
if [[ ! $e =~ 'not a git repository' ]]
then git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)] /"
fi
@mars
mars / bulk_email.rb
Created July 25, 2012 20:07
Bulk email via gmail
require "rubygems"
# gem install ruby-gmail
require 'gmail'
# gather email list
addresses = %w{
email1@domain.com
email2@domain.com