Skip to content

Instantly share code, notes, and snippets.

View jacoborus's full-sized avatar

Jacobo Tabernero jacoborus

View GitHub Profile
@jacoborus
jacoborus / outputTemp.js
Last active July 23, 2019 14:10
closerToZero
function outputTemp (tempRow) {
return tempRow
.split(' ')
.map(n => Number(n))
.reduce((min, val) => {
const abs = Math.abs(val)
const pos = val >= 0
if ((pos && abs === min.abs) || abs < min.abs) {
return { val, abs }
}
@jacoborus
jacoborus / .tmux.conf
Last active July 23, 2017 02:10
tmux + vim configuration
# set Zsh as your default Tmux shell
set-option -g default-shell /bin/zsh
# UTF is great, let us use that
set -g utf8
set-window-option -g utf8 on
# Tmux should be pretty, we need 256 color for that
set -g default-terminal "screen-256color"
@jacoborus
jacoborus / UUID4.js
Last active December 29, 2015 23:39
UUID rfc4122 version 4
// from http://stackoverflow.com/a/2117523/1409080
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
@jacoborus
jacoborus / Preferences.sublime-settings
Created August 1, 2013 23:21
My Sublime Text user settings
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"folder_exclude_patterns":
[
".svn",
".git",
".hg",
"CVS",
".subl"
],
@jacoborus
jacoborus / safename.js
Created July 23, 2013 03:40
Basic safe name for files
/* safe name for files */
var safeFilename = function ( name ) {
name = name.replace(/ /g, '-');
name = name.replace(/[^A-Za-z0-9-_\.]/g, '');
name = name.replace(/\.+/g, '.');
name = name.replace(/-+/g, '-');
name = name.replace(/_+/g, '_');
return name;
}
/* The API controller
Exports 3 methods:
* post - Creates a new thread
* list - Returns a list of threads
* show - Displays a thread and its posts
*/
var Thread = require('../models/thread.js');
var Post = require('../models/post.js');
import urlparse
import oauth2 as oauth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'
@jacoborus
jacoborus / Monokai Pastel.tmTheme
Created May 7, 2013 08:08
Sublime Text color scheme - Monokai Pastel
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai Pastel</string>
@jacoborus
jacoborus / letterbyletter.js
Created November 8, 2012 00:16
Simple jQuery/Zepto plugin for typing character by character texts
/**
* jQuery.letterByLetter
* Version 0.3.0
*
* Simple jQuery/Zepto plugin for typing character by character texts
* Standard call:
$('.myDivs').LetterByLetter({
'speed' : 150
});
@jacoborus
jacoborus / protege.php
Created November 2, 2012 09:02
Proteger PHP frente a inyecciones
<?php
function protege($texto) {
$texto = str_replace("'", "\'", $texto);
$texto = htmlspecialchars ($texto);
$texto = htmlentities ($texto);
$texto = trim ($texto);