Skip to content

Instantly share code, notes, and snippets.

def calculate (formula, valor1, valor2)
case formula
when "+" then resultado = valor1+valor2
when "-" then resultado = valor1-valor2
when "*" then resultado = valor1*valor2
when "/" then resultado = valor1/valor2
print resultado.to_s
end
end
from xml.dom import minidom
import json
config = {
'svg_file' : 'map.svg',
'js_file' : 'map.js',
'js_var' : 'svgMap'
}
svg = minidom.parse(config['svg_file'])
@eporroa
eporroa / webdev_utils.txt
Last active December 24, 2015 06:59
Web Development Utils tricks, commands or code snippets
##### ----- MySQL: ----- #####
#http://www.ducea.com/2006/10/28/compressing-mysqldump-output/
#dump a DB adding a time as filename and compress with gzip
mysqldump --compact -C --add-drop-table -u [user] -p --host=<host> <databasename> > backup_`date +%y%m%d`.sql | gzip -9 > backup_`date +%y%m%d`.sql
#import a database for MAMP
~ /Applications/MAMP/Library/bin/mysql -u [username] -p [database] < [path to file]
##### ----- /MySQL ----- #####
# Global
alias l='ls -lah' # Long view, show hidden
alias ls='ls -GFp' # Compact view, show colors
alias la='ls -AF' # Compact view, show hidden
alias ll='ls -lFh' # Long view, no hidden
alias grep='grep --color=auto' # Always highlight grep search term
alias ping='ping -c 5' # Pings with 5 packets, not unlimited
alias df='df -h' # Disk free, in gigabytes, not bytes
alias du='du -h -c' # Calculate total disk usage for a folder
alias ..='cd ..' # Go up one directory
@eporroa
eporroa / gist:9743835
Last active December 19, 2017 06:34
git utils
##Git Blame File list of commiters sorted:
git blame --line-porcelain adCreativesControl.js | sed -n 's/^author //p' | sort | uniq -c | sort -rn

Descargar archivos

wget http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2
wget -O taglist.zip http://www.vim.org/scripts/download_script.php?src_id=7701
@eporroa
eporroa / Preferences.sublime-settings
Created May 27, 2014 17:47
SublimeText2 User Preferences
{
"draw_white_space": "all",
"font_size": 13.0,
"ignored_packages":
[
"Vintage"
],
"rulers":
[
120
@eporroa
eporroa / fib
Last active August 29, 2015 14:04
My fast fibonacci
function fibonacci(n) {
return Array.apply(0, Array(n+1)).reduce(function(prev, curr, index, arr){
return prev.concat((index < 2) ? index : prev[index-1] + prev[index-2]);
}, []).pop();
}
gruntFunction = (grunt)->
if grunt.option('dev')
env = 'development'
else if grunt.option('deploy')
env = 'deployment'
else if grunt.option('prod')
env = 'production'
else
env = grunt.option('env') || 'development'

ffmpeg -i input -c:v libx264 -crf 23 -preset medium -c:a libfdk_aac -vbr 4 \ -movflags +faststart -vf scale=-2:720,format=yuv420p output.mp4

for f in *.MOV; do ffmpeg -i "$f" -vf scale=-2:480,format=yuv420p "${f%.MOV}.mp4"; done

for f in *.MOV; do ffmpeg -i "$f" -vf scale=-2:480,format=yuv420p convertido/"${f%.MOV}.mp4"; done