Skip to content

Instantly share code, notes, and snippets.

@mloayzagahona
mloayzagahona / cat.py
Created March 23, 2018 17:56 — forked from dimo414/cat.py
Fast File Concatenation in Python
'''
Tests different methods of concatenating files in Python.
'''
from __future__ import print_function
import json,os,shutil,subprocess
import util
def verify(file,expected):
count = 0
@mloayzagahona
mloayzagahona / filter-flow-release-start-version
Created September 16, 2017 21:33 — forked from petervanderdoes/filter-flow-release-start-version
gitflow hooks and filters for WordPress theme development
#!/bin/sh
#
# Runs during git flow release start
#
# Positional arguments:
# $1 Version
#
# Return VERSION - When VERSION is returned empty gitflow
# will stop as the version is necessary
#
@mloayzagahona
mloayzagahona / gist:d4bda6d6d74a45233292f3b42cb8198a
Created May 8, 2017 21:27 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

@mloayzagahona
mloayzagahona / gist:f776b6479113e6565f26d32720ebb5c9
Created May 8, 2017 21:27 — forked from Bouke/gist:11261620
Multiple Python installations on OS X

Previous versions used homebrew to install the various versions. As suggested in the comments, it's better to use pyenv instead. If you are looking for the previous version of this document, see the revision history.

$ brew update
$ brew install pyenv
$ pyenv install 3.5.0
$ pyenv install 3.4.3
$ pyenv install 3.3.6
$ pyenv install 3.2.6
$ pyenv install 2.7.10

$ pyenv install 2.6.9

app.directive('faFastScroll', ['$parse', function ($parse) {
var Interval = function(min, max) {
this.min = min || 0;
this.max = max || 0;
};
Interval.prototype.clip = function(min, max) {
if(this.max <= min || this.min >= max) {
this.min = this.max = 0;
@mloayzagahona
mloayzagahona / bootstrap-breakpoints.sass
Created December 28, 2016 00:01 — forked from webinfinita/bootstrap-breakpoints.sass
Variables for responsive design in bootstrap with sass
@mixin breakpoint($point)
@if $point == lg
@media (min-width: 1200px)
@content
@else if $point == md
@media (min-width: 992px) and (max-width: 1199px)
@content
@else if $point == sm
@mloayzagahona
mloayzagahona / thoughts.md
Created December 17, 2016 15:37 — forked from floatdrop/thoughts.md
Error management in gulp

#Error management in gulp

Sucking at something is the first step to becoming sorta good at something

No one can assure you, that plugins will run smooth in any circumstances (except for tests - they could), so neither should you convince anyone, that your plugin will never break. Only thing, that you could possibly do (if something gone wrong) - is gracefully inform your plugin user, that something went wrong and die.

We are will use this plugin from beginning to demonstrate error management. Suppose you have a task in gulpfile.js that contains this code (we modified it a little bit to be closer to real-usage):

var coffee = require('gulp-coffee');
@mloayzagahona
mloayzagahona / gulp-tasks-scripts.js
Created December 17, 2016 15:22 — forked from hash-bang/gulp-tasks-scripts.js
Example Gulp task for scripts building using gulp-notify
/**
* Compile all JS files into the build directory
*/
var scriptBootCount = 0;
gulp.task('scripts', ['load:config'], function() {
var hasErr;
return gulp.src(paths.scripts)
.pipe(gplumber({
errorHandler: function(err) {
gutil.log(colors.red('ERROR DURING JS BUILD'));
@mloayzagahona
mloayzagahona / $logDecorator.js
Created December 16, 2016 20:49
AngularJS - Disable logging
(function() {
var app = angular.module('myApp', []);
app.config(['$provide', function($provide) {
// decorates the $log instance to disable logging
$provide.decorator('$log', ['$delegate',
function($delegate) {
var $log, enabled = true;
$log = {
@mloayzagahona
mloayzagahona / *.md
Created December 10, 2016 04:34
Component versus Directive in AngularJS

Component versus Directive in AngularJS

.component()

Components are not "helper" methods, they are the best change in Angular 1.x since I've been using it.

What is the role of .component()?

  • Declares new HTML via a template or templateUrl
  • Should be used to create Components as part of a Component architecture