Skip to content

Instantly share code, notes, and snippets.

View mandelbro's full-sized avatar
🌀

Chris Montes mandelbro

🌀
View GitHub Profile
require: rubocop-rspec
AllCops:
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
TargetRubyVersion: 2.7
Exclude:
- '**/node_modules/**/*'
- '**/vendor/**/*'
;(function ( app ) {
'use strict';
angular.module('PeachDelivery')
.factory("DeployService", DeployService);
DeployService.$inject = [];
function DeployService () {
@mandelbro
mandelbro / IIFE
Last active August 31, 2016 17:46
;(function () {
"use strict";
// code in here keeps the global scope clean!
var globalVar = "I'm a global variable!";
function privateFunction () {
return "I'm a private function!";
}
app.directive("scrollToOnLoad", [
'$location',
function( $location ) {
return {
restrict: "A",
link: function(scope, element, attributes) {
var scrollTo = $location.hash() === attributes.id;
// scroll to the top of the posting with a padding for the header
if(scrollTo) {
@mandelbro
mandelbro / drush-cheatsheet.txt
Created April 11, 2014 18:31
SPT Drush Cheatsheet
Get files from the dev server
sudo -E rsync --recursive --compress --times --rsh='ssh -l deploy' \
spt-stage.com:/var/www/deploy/current/sites/de.animax/files/ \
/var/www/deploy/current/sites/de.animax/files/ && chown -R vagrant:www-data /var/www/deploy/current/sites/de.animax/files && sudo chmod -R 777 /var/www/deploy/current/sites/de.animax/files && find /var/www/deploy/current/sites/de.animax/files -type d -exec sudo chmod 777 -R {} \;
All database commands
drush @de.animax sql-drop -y && drush cc drush && ssh -l chrismontes spt-stage.com drush @de.animax sql-dump | drush @de.animax sql-cli && drush @de.animax updb -y && drush @de.animax ucrt root --mail="chrismontes@about.me" --password="rewt" && drush @de.animax urol "super administrator" --name=root && drush @de.animax vset preprocess_css 0 --yes && drush @de.animax vset preprocess_js 0 --yes && drush @de.animax vset block_cache 0 --yes && drush @de.animax vset cache 0 --yes && drush @de.animax vset cache_content_flush_cache_block 0 --yes && drus
@mandelbro
mandelbro / zepto-jquery-wrapper.js
Last active August 29, 2015 13:56
Zepto/jQuery Wrapper
/**
* A simple JavaScript wrapper that will provide allow
* you to take advantage of the ZeptoJS library if it
* is available, and fallback to jQuery if not.
*
* Based on this pattern explanation from Stack Overflow:
* http://stackoverflow.com/a/502068
*/
;(function( $, window, undefined ) {
/**
* Blueprint JS starter view controller
*/
var exampleViewController = (function( $, window, undefined ) {
// this is a private function
var buildListeners = function() {
var self = this,
// add a map of callbacks to use for the listeners below
callbacks = {};
@mandelbro
mandelbro / zepto-jquery-plugin-boilerplate.js
Last active December 22, 2015 21:19
jQuery/Zepto Plugin Boilerplate
/*jslint devel: true, nomen: true, unparam: true, white: true, indent: 4 */
//
// $.fn.pluginName
//
;(function ($, window, undefined) {
// Give the plugin a descriptive name
var pluginName = 'pluginName',
@mandelbro
mandelbro / getGrabberEvents.js
Last active December 22, 2015 00:59
Touch event detection is tricky now that desktop browsers are reporting touch events in windows. This script first checks for MS Pointer events, which combine touch and click events for devices like the Surface or HP touchsmart laptops. Otherwise it checks for HTML5 standard touch events AND the window.orientation object, this ensures the user i…
// this will pull events for a grabber action: down, up, and move
var getGrabberEvents = function() {
// run through possible events
if(window.navigator.msPointerEnabled) { // windows specific
// see http://msdn.microsoft.com/en-us/library/ie/hh673557(v=vs.85).aspx
return 'MSPointerDown MSPointerUp MSPointerMove';
} else if(window.orientation && Modernizr.touch) { // html5 standard touch events
// if you don't want to use modernizr, see this thread:
// http://stackoverflow.com/questions/14267598/is-there-a-more-elegant-way-to-detect-touch-events-support-and-assign-either-a
return 'touchstart touchend touchmove';
@mandelbro
mandelbro / Development Questionnaire
Last active December 20, 2015 15:28
This is the questionnaire I use for starting new web development projects, chiefly when I am taking a project over from design.
#########################################################################################
# _ _ _ ______ _____ _ _ #
# | | | | | | | _ \ | _ | | | (_) #
# | | | | ___| |__ | | | |_____ __ | | | |_ _ ___ ___| |_ _ ___ _ __ ___ #
# | |/\| |/ _ \ '_ \ | | | / _ \ \ / / | | | | | | |/ _ \/ __| __| |/ _ \| '_ \/ __| #
# \ /\ / __/ |_) | | |/ / __/\ V / \ \/' / |_| | __/\__ \ |_| | (_) | | | \__ \ #
# \/ \/ \___|_.__/ |___/ \___| \_/ \_/\_\\__,_|\___||___/\__|_|\___/|_| |_|___/ #
# #
#########################################################################################