This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.vundle | |
" -- DEFAULTS -- | |
" UTF-8 encoding | |
set encoding=utf-8 | |
cd ~/Sites | |
" Set leader key to , | |
let mapleader="," | |
" Don't close buffers, hide them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'gmarik/Vundle.vim' | |
Plugin 'Valloric/YouCompleteMe' | |
Plugin 'SirVer/ultisnips' | |
Plugin 'godlygeek/tabular' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! <SID>StripTrailingWhitespaces() | |
" Preparation: save last search, and cursor position. | |
let _s=@/ | |
let l = line(".") | |
let c = col(".") | |
" Do the business: | |
%s/\s\+$//e | |
" Clean up: restore previous search history, and cursor position | |
let @/=_s | |
call cursor(l, c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (condition) { | |
case true: | |
// Yes | |
break; | |
case false: | |
// No | |
break; | |
default: | |
// Maybe | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseTime (initialTime) { | |
var time = parseInt(initialTime); | |
var result = ''; | |
if (time <= 59) { | |
result = time > 9 ? '00:' + time : '00:0' + time; | |
} else if (time > 59 && time <= 3599) { | |
var minutes = 0; | |
while (time > 59) { | |
time -= 60; | |
minutes += 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ~/.vundle | |
" -- DEFAULTS -- | |
" UTF-8 encoding | |
set encoding=utf-8 | |
" Default dir is sites | |
cd ~/Appsbroker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def kebab_to_camel(string): | |
splitted = string.split('-') | |
result = [part.title() for part in splitted[1:]] | |
result.insert(0, splitted[0].lower()) | |
return ''.join(result) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (s) { | |
return [~~(s / 3600), ~~((s % 3600) / 60), s % 60].map(v => v < 10 ? '0' + v : v).join(':'); | |
})([].slice.call(document.querySelectorAll('.duration')) | |
.filter((e, i, a) => ++i <= (a.length / 3)) | |
.map(h => { | |
var t = h.textContent.match(/[0-9]{1,2}:[0-9]{1,2}/); | |
var p = t[0].split(':').map(Number); | |
return (p[0] * 60) + p[1] | |
}).reduce((p, c) => p + c, 0)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handlePossibleError(err) { | |
if (!err) return; | |
console.log('------- ERROR --------'); | |
console.error(err); | |
console.log('----------------------'); | |
} | |
function insertIntoDatabase(db, data) { | |
var tweets = db.collection('tweets'); | |
var reg = /(https:\/\/.+)/g; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# allow pbcopy | pbpase on OSX | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# set colours | |
set -g default-terminal "screen-256color" | |
# use ctrl+a rather than ctrl+b (capslock == ctrl) | |
unbind C-b | |
set-option -g prefix C-a | |
bind C-a send-prefix |
OlderNewer