Skip to content

Instantly share code, notes, and snippets.

View threewordphrase's full-sized avatar

Aaron Smith threewordphrase

View GitHub Profile
shooter.createSitemap = function (postableData) {
SitemapService.create({sid: siteId}, postableData, function (data) {
$state.go('site.viewSitemap', {sid: siteId, sitemapId: data.data.id});
}, function (data) { //failure
//error handling goes here
Noty(data.data.message, 'error');
});
};
@threewordphrase
threewordphrase / screenshooterControllers.js
Created October 8, 2014 15:58
angular controller as within a modal
shooter.createSitemapModal = function () {
var cloneModalInstanceCtrl = $modal.open({
templateUrl: path + 'sitemaps/templates/_modal_create_sitemap.html',
controller: 'CreateSitemapController as createSitemap'
});
cloneModalInstanceCtrl.result.then(function (sitemap) {
shooter.createSitemap(sitemap);
});
};
function bc(){
var template = ['<ul class="breadcrumb">',
'<li>',
'<a ui-sref="dashboard">Dashboard</a>',
'</li>',
'<li ng-repeat="breadcrumb in breadcrumbs">',
'<a href="#{{ breadcrumb.path }}">{{ breadcrumb.title }} </a>',
'</li>',
'</ul>'].join('');
return {
@threewordphrase
threewordphrase / pre-push
Created September 18, 2015 17:59
RSpec pre-push git hook
echo "Running RSpec"
bundle exec rake spec
spec=$?
if [ $spec -eq 0 ]; then
osascript -e 'display notification "Tests have passed, pushing" with title "EMT Specs"'
echo "\\033[32mTests are green, pushing...\\033[0;39m"
exit 0
else
osascript -e 'display notification "Tests have failed, stopping push" with title "EMT Specs"'
@threewordphrase
threewordphrase / branch-diff
Created January 12, 2016 15:24
branch-diff
#!/usr/bin/env ruby
#
# List branches merged into integration but not master: branch-diff --yes integration --no master
#
# List commits present in integration but not master: branch-diff --commits --yes integration --no master
#
require 'optparse'
require 'ostruct'
class OptparseExample
@threewordphrase
threewordphrase / README
Last active January 12, 2016 18:26
Simple "Oh shit" uptime checker for when nothing else is set up yet, displays OSX notification when URL returns a non-200 code.
cd ~/Library/LaunchAgents/
# plist goes in this directory
launchctl load com.aaron.whatever.plist
# Disable:
launchctl unload com.aaron.whatever.plist
if (EPURA_ENVIRONMENT === 'test'){
angular.module('warehouse').factory('cacheBustInterceptor', function() {
return {
request: function(config) {
if (config.method === 'GET' && config.url.indexOf('/api/') > -1) {
if (config.params === undefined) {
config.params = {};
}
config.params.bust = Math.random().toString(36).replace(/[^a-z]+/g, '');
module FeatureHelpers
def ng_visit(state_name, route_params={}, options={})
js_route_params = route_params.to_json
js_route_opts = {
reload: true
}.merge(options).to_json
inactive = (page.evaluate_script("typeof(angular)") == 'undefined')
array = [
1,
2,
[3, 4, 5, [6, 7, 8]],
[9, 10, 11, 12],
13
]
@capture = []