Skip to content

Instantly share code, notes, and snippets.

View IvanTorresEdge's full-sized avatar
👨‍💻
full-on building mode and loving every minute of it

Ivan Torres IvanTorresEdge

👨‍💻
full-on building mode and loving every minute of it
View GitHub Profile
@IvanTorresEdge
IvanTorresEdge / underscore-debounce-example.js
Created December 27, 2017 12:27 — forked from kimmobrunfeldt/underscore-debounce-example.js
Example of using Underscore's _.debounce function
// Example of using Underscore's _.debounce function
// debounce is useful for situations where you get multiple events fired
// from one action. For example resize event is sent multiple times when
// window is resized
var reloadIfResizeChange = _.debounce(function() {
window.location.reload();
}, 200);
window.addEventListener('resize', reloadIfResizeChange);
@IvanTorresEdge
IvanTorresEdge / callModifierForSelectedBlocks.js
Created December 27, 2017 02:40 — forked from johanneslumpe/callModifierForSelectedBlocks.js
Draft.js utilities to inspect/modify selected block ranges
import { EditorState, SelectionState } from 'draft-js';
import getSelectedBlocks from './getSelectedBlocks';
/**
* Calls a provided `modifier` function with a selection for each
* selected block in the current editor selection. Passes through additional
* arguments to the modifier.
*
* Note: At the moment it will retain the original selection and override
@IvanTorresEdge
IvanTorresEdge / keyrepeat.shell
Created November 28, 2016 23:24 — forked from rastasheep/keyrepeat.shell
Enable key repeat in Apple Lion for Atom in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Atom if you're running vim mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@IvanTorresEdge
IvanTorresEdge / gulpfile.js
Created April 18, 2016 16:00 — forked from heldr/gulpfile.js
Another way of splitting a gulpfile into multiple files
/*
Another way of splitting a gulpfile into multiple files based on:
http://macr.ae/article/splitting-gulpfile-multiple-files.html
https://github.com/gulpjs/gulp/blob/master/docs/recipes/split-tasks-across-multiple-files.md
*/
'use strict';
var gulp = require('gulp'),
plugins = require('gulp-load-plugins')(),
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="../libs/mocha.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<div id="mocha"></div>
<script src="../libs/mocha.js" type="text/javascript" charset="utf-8"></script>

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@IvanTorresEdge
IvanTorresEdge / jquery.textselect.js
Created December 4, 2012 17:09 — forked from canadaduane/jquery.textselect.js
jQuery Text Selection method and events
/* jQuery plugin textselect
* version: 1.0
* tested on jQuery 1.3.2, 1.5
* author: josef.moravec@gmail.com, duane.johnson@gmail.com
*
* usage:
* $(function() {
* $(document).bind('textselect', function(e) {
* Do stuff with e.text
* });
@IvanTorresEdge
IvanTorresEdge / build.js
Created October 11, 2012 06:48 — forked from jrburke/build.js
Doing multiple almond builds with a nodejs script, example
//Download jquery.js and place it in the build, do not use require-jquery.js
//in the build, since each of the build layers just needs almond and not the
//full require.js file.
//This file is run in nodejs to do the build: node build.js
//Load the requirejs optimizer
var requirejs = require('./r.js');
//Set up basic config, include config that is
//common to all the requirejs.optimize() calls.
/*
* a backwards compatable implementation of postMessage
* by Josh Fraser (joshfraser.com)
* released under the Apache 2.0 license.
*
* this code was adapted from Ben Alman's jQuery postMessage code found at:
* http://benalman.com/projects/jquery-postmessage-plugin/
*
* other inspiration was taken from Luke Shepard's code for Facebook Connect:
* http://github.com/facebook/connect-js/blob/master/src/core/xd.js