Skip to content

Instantly share code, notes, and snippets.

@kiub
kiub / controller.js
Last active August 29, 2015 14:25 — forked from eyston/controller.js
angular typeahead
angular.module('ymusica').controller('AlbumSearch', ['$scope', 'Albums', 'Artists', '$q', function($scope, albums, artists, $q) {
$scope.albums = [];
$scope.artists = [];
var terms = new Rx.Subject();
$scope.searchMusic = terms.onNext.bind(terms);
terms.sample(250)
# bash function, usage: $ st -p [projectname] -opt2 -opt3
function sublime() {
if [ -n "$1" -a -n "$2" ]; then # if more than one argument
if [ "$1" = "-p" -o "$1" = "--project" ]; then # if arg1 is -p or --project
local projectfile="$2"
[[ $projectfile != *.sublime-project ]] && projectfile="$2.sublime-project" # detect if arg2 already includes the ext
if [ -e $projectfile ]; then # does project file exist?
subl -n --project $projectfile ${*:3} # open project file, in new window, include trailing args
#echo "project specified, and project file exists, execute: subl -n --project $projectfile ${*:3}"
else
@kiub
kiub / gist:6412964
Last active December 22, 2015 03:49
# Sample code for sending MailChimp Email Campaigns from a Rails App using Gibbon API wrapper v0.3.5
# All recipients must already be on the associated MailChimp list (list_id), for this app we add those via another
# API call every few minutes.
#
# Member function of EmailCampaign.rb model
# See http://labs.saidigital.co/using-mailchimp-api-to-send-email-campaigns-to-a-dynamic-set-of-email-addresses-425/
# for explanation.
def send_campaign(api_key, gb, list_id, template_id, from_name, from_email)
self.reset_unique_id
segment_id = gb.list_static_segment_add(:id => list_id, :name => self.safe_name)
@kiub
kiub / functions.php
Created November 11, 2012 19:07 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress.
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );