Skip to content

Instantly share code, notes, and snippets.

View helmutgranda's full-sized avatar

Helmut Granda helmutgranda

View GitHub Profile
@helmutgranda
helmutgranda / .bash_profile
Created August 2, 2011 15:43
Open a file with specific program
# use the following to open a file with a specific program
function functionName()
{
open -a program $1
}
#usage
$ functionName file
@helmutgranda
helmutgranda / .bash_profile
Created August 4, 2011 16:16
Use command line to take a screenshot of a video
function fg ()
{
ffmpeg -i ./$1.f4v -r 1 -ss 00:00:00 -t 00:00:01 ./screenshots/$1.png
}
# usage
# fg FILENAME
@helmutgranda
helmutgranda / backbone_conversion1.coffee
Created February 14, 2012 15:57
Quick conversion, then will move into an actual repo
$ = jQuery
class ListView extends Backbone.View
el: $('body')
initialize: ->
@.render()
render: =>
@el.append("<ul><li>hw</li></ul>")
@helmutgranda
helmutgranda / restart_apache.sh
Created March 7, 2012 17:59
Restart Apache 2
$ /etc/init.d/apache2 restart
@helmutgranda
helmutgranda / getaformbyxpath.js
Created November 6, 2012 14:57
Get a form by XPath | CasperJS
var formObj = casper.evaluate(function() {
return __utils__.getElementsByXPath('//*[@id="ff_form_main"]');
});
@helmutgranda
helmutgranda / curl_commandline
Last active December 14, 2015 06:19
Minify with CURL on the command line
curl \
-d output_info=compiled_code \
-d compilation_level=SIMPLE_OPTIMIZATIONS \
-d code_url=https://github.com/path/to/javascript.js \
http://closure-compiler.appspot.com/compile > file.js
@helmutgranda
helmutgranda / dreamhost_ssh
Last active December 15, 2015 08:29
SSH to Dreamhost without having to enter credentials every time.
([ -f ~/.ssh/id_rsa.pub ] || ssh-keygen -t rsa ) && (ssh user@example.com "([ -d ~/.ssh ]||mkdir -m 700 ~/.ssh) && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub)
@helmutgranda
helmutgranda / list_of_world_countries
Created August 29, 2013 20:11
List of World Countries
$country_list = array(
"Afghanistan",
"Albania",
"Algeria",
"Andorra",
"Angola",
"Antigua and Barbuda",
"Argentina",
"Armenia",
"Australia",
@helmutgranda
helmutgranda / wordpress_update_string_mysql
Created October 2, 2013 21:55
WordPress - Update strings on database
#Update main content
UPDATE wp_posts SET post_content = REPLACE ( post_content, 'http://www.helmutgranda.com/', 'https://www.helmutgranda.com/');
#Update Custom fields
UPDATE wp_postmeta SET meta_value = REPLACE ( meta_value, 'http://www.helmutgranda.com/', 'https://www.helmutgranda.com/');
@helmutgranda
helmutgranda / fiddle.css
Last active December 26, 2015 02:19 — forked from zalun/fiddle.css
body {
font-family: Helvetica, Verdana
}
p {
padding: 7px 10px;
}
#demo {
border: 1px solid #999;
}