Skip to content

Instantly share code, notes, and snippets.

View rudisimo's full-sized avatar
🔕

Rudy Puig rudisimo

🔕
View GitHub Profile
@rudisimo
rudisimo / gist:5169574
Created March 15, 2013 12:31
Cortex README.md

Cortex

Core JavaScript library for Telemundo.com.

How to build your own Cortex

First, clone a copy of the main Cortex git repo by running:

@rudisimo
rudisimo / url.php
Last active December 18, 2015 22:29
PHP learning session.
<?php
/**
* Data tokenizer interface.
*/
interface Tokenized {
function hash();
function tokenize();
}
@rudisimo
rudisimo / gist:5864637
Created June 26, 2013 03:52
Ubuntu history
cd ~; curl -#L https://github.com/rudisimo/dotfiles/tarball/master | tar -xzv --strip-components 1 --exclude={README.md,LICENSE-MIT.txt,bootstrap.sh};
vim .profile
curl -Lo- https://bit.ly/janus-bootstrap | bash
sudo apt-get install git
curl -Lo- https://bit.ly/janus-bootstrap | bash
sudo apt-get install ruby
sudo apt-get search gem
sudo apt-cache search gem
sudo apt-cache search gem | grep gem
sudo apt-cache search gem | grep " gem"
# Git credentials
GIT_AUTHOR_NAME="Luciano Araujo"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
GIT_AUTHOR_EMAIL="luciano.h.araujo@gmail.com"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
export GIT_AUTHOR_NAME GIT_COMMITTER_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_EMAIL
username=$(git config --global --get user.name)
if [ ! -n "$username" ]; then
git config --global user.name "$GIT_AUTHOR_NAME"
#LoadModule php5_module /usr/local/opt/php54/libexec/apache2/libphp5.so
#<IfModule php5_module>
# AddType application/x-httpd-php .php
# AddType application/x-httpd-php-source .phps
# <IfModule dir_module>
# DirectoryIndex index.html index.php
# </IfModule>
#</IfModule>
ScriptAlias /php54-cgi /usr/local/opt/php54/bin/php-cgi
@rudisimo
rudisimo / gist:6550645
Last active December 22, 2015 23:59
macvim failed to build on 10.8

brew install -v macvim 2>&1

==> Downloading https://github.com/b4winckler/macvim/archive/snapshot-71.tar.gz
Already downloaded: /Library/Caches/Homebrew/macvim-7.4-71.tar.gz
tar xf /Library/Caches/Homebrew/macvim-7.4-71.tar.gz
==> ./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --with-ruby-command=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-tlib=ncurses --with-compiledby=Homebrew --with-local-dir=/usr/local --enable-cscope --enable-pythoninterp=yes
./configure --with-features=huge --enable-multibyte --with-macarchs=x86_64 --enable-perlinterp --enable-rubyinterp --enable-tclinterp --with-ruby-command=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby --with-tlib=ncurses --with-compiledby=Homebrew --with-local-dir=/usr/local --enable-cscope --enable-pythoninterp=yes
configure: creating cache auto/config.cache

checking whether make sets $(MAKE)...

@rudisimo
rudisimo / gist:6673368
Created September 23, 2013 16:43
.htaccess
AddHandler application/x-httpd-php52 .php
SetEnv PHPRC /usr/local/etc/php/5.2
SetEnv PHP_INI_SCAN_DIR /usr/local/etc/php/5.2/conf.d
AddHandler application/x-httpd-php53 .php
SetEnv PHPRC /usr/local/etc/php/5.3
SetEnv PHP_INI_SCAN_DIR /usr/local/etc/php/5.3/conf.d
AddHandler application/x-httpd-php54 .php
SetEnv PHPRC /usr/local/etc/php/5.4
Bootstrap to phase 0. [0.01 sec, 3.77 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.02 sec, 4 MB] [bootstrap]
Loading drushrc [bootstrap]
"/mnt/www/html/dbtv/docroot/sites/all/drush/drushrc.php" into
"drupal" scope. [0.03 sec, 4.01 MB]
Include /mnt/www/html/dbtv/docroot/sites/all/drush/commands [0.04 [notice]
sec, 4.03 MB]
Cache HIT cid: 5.8-commandfiles-0-0db0da8ecb2a8aed88ffd7e75f9b6779 [debug]
[0.05 sec, 4.05 MB]
DRUSH_BACKEND:{"type":"bootstrap","message":"Bootstrap to phase 0.","timestamp":1380160810.668,"memory":11040680,"error":null,"packet":"log"}
import sys
test_cases = open(sys.argv[1], 'r')
for test in test_cases:
(items, swaps) = test.rstrip('\n').split(":")
items = [item.strip(' ') for item in items.strip(' ').split(' ')]
swaps = [swap.strip(' ').split('-') for swap in swaps.strip(' ').split(',')]
for swap in swaps:
(a, b) = [int(pos) for pos in swap]
items[b], items[a] = items[a], items[b]
print ' '.join(items)
@rudisimo
rudisimo / os.rb
Last active December 25, 2015 17:39
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 sts=2 et :
require 'date'
require 'find'
module OS
def OS.win?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end