Skip to content

Instantly share code, notes, and snippets.

View filiperocha's full-sized avatar

Filipe Rocha filiperocha

View GitHub Profile
@filiperocha
filiperocha / pkg_control.sh
Created July 16, 2012 17:07
pkg_control.sh
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
#!/usr/bin/env node
function primeNumbers(n) {
arr = [];
for (var i = 2; arr.length < n; i++) {
var is_div = false;
for (var count = 2; count < i; count++) {
if (i % count === 0) {
is_div = true;
break;
#!/bin/bash
# A Shell Script To Convert All .flac Files To .MP3 Format
# Note: I found this script somewhere on usenet and I've modified it for my needs
METAFLAC=/usr/local/bin/metaflac
FLAC=/usr/local/bin/flac
#ID3=/usr/bin/id3
LAME=/usr/local/bin/lame
FIND=/usr/bin/find
t=$(${FIND} . -type f -iname "*.flac")
@filiperocha
filiperocha / yoump3.sh
Created December 12, 2013 11:46 — forked from include/yoump3.sh
#!/bin/bash
URL_LIST=$*
YOUTUBE_DL="/usr/local/bin/youtube-dl"
YOUTUBE_DL_OPTS="--title --restrict-filenames --write-thumbnail --extract-audio --audio-format mp3 --audio-quality 0 --continue --no-overwrites"
${YOUTUBE_DL} ${YOUTUBE_DL_OPTS} ${URL_LIST}
@filiperocha
filiperocha / colors.css
Created January 3, 2014 20:10
colors.css
table .blue {
color: #049cdb;
border-bottom-color: #049cdb;
}
table .green {
color: #46a546;
border-bottom-color: #46a546;
}
table .red {
color: #9d261d;
table .blue { color: #049cdb; border-bottom-color: #049cdb; } table .green { color: #46a546; border-bottom-color: #46a546; } table .red { color: #9d261d; border-bottom-color: #9d261d; } table .yellow { color: #ffc40d; border-bottom-color: #ffc40d; } table .orange { color: #f89406; border-bottom-color: #f89406; } table .purple { color: #7a43b6; border-bottom-color: #7a43b6; }
@filiperocha
filiperocha / VariableImporter.jsx
Last active January 3, 2016 12:33
Import Illustrator Variables
/**
* @@@BUILDINFO@@@ VariableImporter.jsx !Version! Tue Dec 15 2015 03:06:17 GMT-0600
*/
/*
============================= VARIABLE IMPORTER Version 7.1.3 ==============================
By Vasily Hall
e:
[email protected]
LinkedIn:
@filiperocha
filiperocha / couchdb-undelete.rb
Created February 20, 2016 07:46 — forked from vjt/couchdb-undelete.rb
Undeletes a document from a CouchDB database.
#!/usr/bin/env ruby
#
# Undelete a document from a CouchDB database.
#
# Recovers a previously deleted document by looking at the _changes
# feed, putting a new empty document preserving the revisions chain,
# retrieves the revs_info for the document, asks the user which one
# to recover, and puts back the old revision into place.
#
# For this to work, GETting the document must return error: "not_found",
# encoding: utf-8
# @author Filipe Rocha <[email protected]>
# Describe Portugal's Administrative Areas
class DistritoConcelho
# @return [Array] list of [concelho, [distritos]]
def self.list
[
['Aveiro', ['Águeda', 'Albergaria-a-Velha', 'Anadia', 'Arouca', 'Aveiro', 'Castelo de Paiva', 'Espinho', 'Estarreja', 'Santa Maria da Feira', 'Ílhavo', 'Mealhada', 'Murtosa', 'Oliveira de Azeméis', 'Oliveira do Bairro', 'Ovar', 'São João da Madeira', 'Sever do Vouga', 'Vagos', 'Vale de Cambra']],
['Beja', ['Aljustrel', 'Almodôvar', 'Alvito', 'Barrancos', 'Beja', 'Castro Verde', 'Cuba', 'Ferreira do Alentejo', 'Mértola', 'Moura', 'Odemira', 'Ourique', 'Serpa', 'Vidigueira']],
@filiperocha
filiperocha / lock.css
Created June 8, 2017 09:47 — forked from visnup/lock.css
"lock" orientation of a website for mobile (iPad, iPhone)
/* if portrait mode is detected, rotate the entire site -90 degrees to hint rotating to landscape */
@media (orientation: portrait) {
body {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
}
}