Skip to content

Instantly share code, notes, and snippets.

View betacar's full-sized avatar
🤓
Tidsoptimist

Carlos Betancourt Carrero betacar

🤓
Tidsoptimist
View GitHub Profile
<%= render '/refinery/content_page', { :hide_sections => [:slider, :boxes] } %>
@betacar
betacar / moviles.txt
Created March 6, 2012 18:34 — forked from edulan/moviles.txt
Whatsapp status crawler
414##GSM/CDMA#Asignado#Movistar
424##GSM#Asignado#Movistar
412##GSM#Asignado#Digitel
416##GSM/CDMA#Asignado#Movilnet
426##GSM#Asignado#Movilnet
@betacar
betacar / .rvmrc
Created December 13, 2011 01:58
Using Heroku enviroment variables within RVM
rvm use 1.9.2@gemset_name
# I use Facebook API ID and secret as an example
export FACEBOOK_APP_ID=[your facebook app id]
export FACEBOOK_SECRET=[your facebook secret]
export HTTP_HOST=localhost:9292/
@betacar
betacar / console-coffee.sublime-snippet
Created July 26, 2015 14:26
Sublime Text snippets
<snippet>
<content><![CDATA[
console.log '######################################################################'
console.log '$1', $2
console.log '######################################################################'
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>console</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.coffee</scope>
@betacar
betacar / package-control-settings.json
Last active August 29, 2015 14:25
Sublime Text Settings
{
"in_process_packages": [],
"installed_packages": [
"Alignment",
"Better CoffeeScript",
"Better RSpec",
"CoffeeCompile",
"Emmet",
"GitGutter",
"HTML Mustache",
@betacar
betacar / collatz_conjecture.js
Last active August 29, 2015 14:21
Famous math problems
var collatz = function(n) {
var result;
console.log(n);
result = n % 2 == 0 ? n/2 : 3 * (n + 1);
return collatz(result);
};
@betacar
betacar / gist:43fc4a8dfc58f1f5589b
Created September 25, 2014 15:13
Print all pull requests from a commit to the branch HEAD
# This should be inside your git config file (global or for a project) as an alias,
# in order to print all merged PRs between a given SHA and current git HEAD.
#
# Thanks to Etan Reisner: http://stackoverflow.com/a/25954749/315748
# Usage: $ git release [SHA]
# It will print...
# [COMMIT-SHA] #PR-NUMBER PULL REQUEST TITLE
# ie.
# [2046946] #872 Lorem ipsum dolor sit amet
// generates a character range collection from a to z
JSON.stringify(Array.apply(null, {length: 26}).map(function (x,i) { return {userId: String.fromCharCode(97 + i) }}));
// generates a collection of from and to
JSON.stringify(Array.apply(null, {length: 26}).map(function (x,i) { from = String.fromCharCode(97 + (Math.random() * (26 - i) + i)); to = String.fromCharCode(97 + (Math.random() * (26 - 0) + 0)); return {from: from, to:to} }));
// generates a collection of user and music
JSON.stringify(Array.apply(null, {length: 100}).map(function (x,i) { return {musicId: "m" + Math.floor(Math.random() * (10 - i) + i), userId: String.fromCharCode(97 + (Math.random() * (26 - 0) + 0))} }));
// generates a random JSON collection with a musicId and generes attributes
@betacar
betacar / conv_to_utf8
Last active August 29, 2015 14:00
Converts all subtitles files of a folder from ISO-8859-1 encoding to UTF-8
#!/bin/bash
for file in ./*.srt
do
encoding=`file --mime-encoding "$file" | awk '{ print $2 }'`
if [ $encoding = "iso-8859-1" ]
then
iconv -f iso-8859-1 -t utf-8 < "$file" > "$file.utf8"
mv "$file.utf8" "$file"
echo "$file converted to UTF-8"
else