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 / show_colors.sh
Created May 16, 2015 19:04
Show terminal colors
#!/usr/bin/env bash
for i in {0..255} ; do
printf "\x1b[38;5;${i}mcolour${i}\n"
done
@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 / adesis.zsh-theme
Last active August 29, 2015 14:10
Adesis ZSH theme
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#
@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>