View MergeAndBreakIntoFiles.macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub MergeAndBreakIntoFiles() | |
' | |
' Merges the current document and splits each section into individual files | |
' | |
' | |
With ActiveDocument.MailMerge | |
.Destination = wdSendToNewDocument | |
.SuppressBlankLines = True | |
.DataSource.ActiveRecord = wdFirstRecord | |
.Execute Pause:=False |
View AnalyticsHelper.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mixpanel-ruby' | |
class AnalyticsHelper | |
def initialize | |
@@tracker = Mixpanel::Tracker.new Rails.application.secrets.mixpanel_token | |
end | |
def track user_id, action, properties=nil | |
Rails.logger.debug "Tracking: #{action}" | |
@@tracker.track(user_id, action, properties || {}) |
View gist:b50a4136dfb9db283794
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"deploy": { | |
"short_app_name_here": { | |
"database": { | |
"adapter": "postgresql", | |
"type": "postgresql" | |
} | |
} | |
}, | |
"sidekiq": { |
View gist:7106916
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to the top of your class | |
#import "Preferences.h" | |
// Add this in your method to get the preference, where desired; the constant comes from Preferences.h | |
NSString *preference = [Preferences getUserPreference:PREFERENCE_NAME_HERE]; |
View Preferences.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#define PREFERENCE_NAME_HERE @"someUniquePreferenceNameHere" | |
@interface Preferences : NSObject | |
#pragma mark Preferences | |
+(id)getUserPreference:(NSString*)forKey; | |
+(void)setUserPreference:(id)value forKey:(NSString*)key; | |
@end |
View Preferences.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "Preferences.h" | |
@implementation Preferences | |
+(id)getUserPreference:(NSString*)forKey | |
{ | |
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; | |
return [defaults valueForKey:forKey]; | |
} |
View gist:6234768
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch -r --merged upstream/master | grep origin | grep -v origin/master | sed 's/ *origin\///' | xargs -I% echo git push origin :% |
View authentication_channel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* AuthenticationChannel | |
* | |
* Usage (from within a controller): | |
AuthenticationChannel.onSetPin($scope, function(pin){ | |
console.log("Pin set to ", pin); | |
}) | |
//anywhere else in your code base | |
AuthenticationChannel.setPin(1234567); //set the pin |
View gist:5243328
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module("MyApp", []); | |
myApp.directive("calendarDay", function () { | |
var linker = function (scope, element, attrs) { | |
element.bind("mousedown", function () { | |
WinJS.UI.Animation.pointerDown(element[0]); | |
}); | |
element.bind("mouseup", function () { | |
WinJS.UI.Animation.pointerUp(element[0]); |
View gist:5240310
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myApp = angular.module("myApp", []); | |
myApp.directive("rangeChange", function ($rootScope) { | |
var linker = function (scope, element, attrs) { | |
var updateScope = function () { | |
scope[attrs.rangeControl](element.val()); | |
//may need to scope.$apply here | |
}; | |
element.bind("change", updateScope); | |
updateScope(); //get the default value | |
}; |
NewerOlder