Skip to content

Instantly share code, notes, and snippets.

Avatar

Juan Pablo Lomeli Diaz tinkertrain

View GitHub Profile
@tinkertrain
tinkertrain / back-ticks.json
Created May 14, 2015
Autoclose back-ticks for SublimeText
View back-ticks.json
// Add this to your user keybindings file
{ "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "[`a-zA-Z0-9`]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.backtick", "match_all": true }
]
},
@tinkertrain
tinkertrain / fb-share.html
Created Aug 5, 2013
Facebook & Twitter share buttons
View fb-share.html
<a target="_blank" href="http://www.facebook.com/sharer/sharer.php?s=100&p[url]=http://google.com&p[images][0]=http://google.com/descarga.png&p[title]=Share%20it!&p[summary]=This%20is%20an%20awesome%20thing%20you%20should%20share">Facebook</a>
@tinkertrain
tinkertrain / flicker.css
Created Aug 6, 2013
Prevent flicker in webkit
View flicker.css
body{
-webkit-backface-visibility: hidden;
-webkit-transform:translate3d(0,0,0);
}
View offset.scss
@mixin _position($position, $args) {
$offsets: top right bottom left;
@each $o in $offsets {
$i: index($args, $o);
@if $i
and $i + 1 <= length($args)
and type-of( nth($args, $i + 1) ) == number {
#{$o}: nth($args, $i + 1);
}
View usa_states.html
<select name="State">
<option value="" selected="selected">Select a State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
@tinkertrain
tinkertrain / add_spaces.txt
Created Oct 28, 2013
Add spaces to dock MacOSX
View add_spaces.txt
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
View flattenArray.js
import { isArray } from './utils';
export default function flattenArray(arr) {
// Use Array.reduce to get our result
let flattened = arr.reduce(function(current, item) {
// Store a reference to the current item
let temp = item;
// Check if the item is an array
@tinkertrain
tinkertrain / .hyper.js
Last active Feb 1, 2017
Hyper settings
View .hyper.js
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 13,
// font family with optional fallbacks
fontFamily: '"Meslo LG L DZ", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
@tinkertrain
tinkertrain / flattenArray.js
Created Aug 3, 2018
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers
View flattenArray.js
/**
* Function that will flatten an array of arbitrarily nested arrays of integers into a flat array of integers
* @param arr The array to flatten
* @param removeNonItems A flag to remove `undefined` and `null` values if set to true
*
* @returns Array
*/
function flatten(arr, removeNonItems = false) {
var nested = false;