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
let mapleader="," | |
set encoding=utf-8 | |
scriptencoding utf-8 | |
set showmatch | |
set showmode | |
set relativenumber | |
set number | |
set textwidth=0 | |
set softtabstop=2 |
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
let mapleader="," | |
set encoding=utf-8 | |
scriptencoding utf-8 | |
set showmatch | |
set showmode | |
set relativenumber | |
set number | |
set textwidth=0 | |
set softtabstop=2 |
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
1. Homework | |
https://blog.codepath.com/2012/11/15/asynchronous-processing-in-web-applications-part-1-a-database-is-not-a-queue | |
2. Fast PHP-shopish redis worker | |
https://www.goworker.org/ | |
3. Compatible lib for PHP shops. | |
https://github.com/spinx/sidekiq-job-php |
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
# When Ruby initializes a program, it instantiates all objects. | |
# | |
# This fires your class definitions as if they were methods. | |
# To illustrate here's an example | |
class Neat | |
p 'I am called' # straight to stdout! | |
# You can dynamically define class constants! | |
%w(ONE TWO THREE).each_with_index { |const, index| const_set const, index+1 } | |
end |
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
--- | |
- name: "Setup Vagrant - Ubuntu 12.04 + RBENV + RUBY + POSTGRESQL + GIT" | |
hosts: vagrant | |
remote_user: "vagrant" | |
gather_facts: False | |
sudo: yes | |
vars: | |
#Default shell | |
- default_shell: /bin/bash | |
#Default Locale |
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
require 'readline' | |
class String | |
# colorization | |
def colorize(color_code) | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
def red | |
colorize(31) |
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
" Quick array creation | |
nmap <leader>ta vF=l<Esc>:s/\%V\S\+/"&",/g<CR>A<BS><Esc>vF=2lgS[JJ:let @/ = ""<CR> |
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
# Tiny ass Luhn CC Check | |
def valid_luhn_cc? cc | |
a = i = 0 | |
cc.each_char { |c| ((i%2)==0)? a+=c.to_i : (c.to_i*2).divmod(10).each { |j| a+=j }; i+=1 } | |
a % 10 == 0 | |
end |
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 collision_test( obj1, obj2 ) | |
var is_colliding = false; | |
if ( obj1.x < obj2.x + obj2.w && | |
obj1.x + obj1.w > obj2.x && | |
obj1.y < obj2.y + obj2.h && | |
obj1.y + obj1.h > obj2.y ) { | |
is_colliding = true; | |
} | |
return is_colliding; | |
} |
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
// Shorter cleaner way to add methods to an object prototype. Thank you Crockford | |
Function.prototype.method = function ( name, func ) { | |
if (! this.prototype[name] ) { this.prototype[name] = func; return this; } | |
}; | |
// And here's the ability to add multiple KVs to objects | |
Function.method( "methods", function ( obj ) { | |
if ( typeof obj !== "object" ) return; | |
for ( var key in obj ) { | |
if ( ! obj.hasOwnProperty( key ) ) continue; | |
this.method( key, obj[key] ); |
NewerOlder