Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabio Neves fzero

View GitHub Profile
@fzero
fzero / masstagger.sh
Created Jul 15, 2011
A quick automatic tagger for MP3 (uses eyeD3 - http://eyed3.nicfit.net)
View masstagger.sh
#!/bin/bash
# This expects files ordered like:
# Artist/Album/01 Track Title.mp3
#
# You should provide the dir containing the Artist dirs at the command line.
START="$1"
if [ "$START" == "" ]; then
@fzero
fzero / wp-upgrade.sh
Created Jul 15, 2011
Update several self-hosted Wordpress blogs at once on Dreamhost
View wp-upgrade.sh
#!/bin/bash
cd $HOME
# Add here every domain/folder where you have Wordpress installed.
# Dreamhost normally puts all domains on $HOME, so this is what I do.
DOMAINS="mydomain1.com mydomain2.com mydomain3.com"
# Add here any dirs, file patterns etc. that you don't want to backup before upgrading.
# These are MY settings; tweak according to your needs.
@rob0t7
rob0t7 / closures.md
Last active Nov 4, 2015
Javascript Closures
View closures.md

Javascript Closures, IIFE

Today we are going to look at some interesting features of the javascript language. Javascript is a prototype-based language with 1st class functions derived from scheme (and self) languages with a C like syntax.

What is a prototype-based language? It is a language of object-oriented programming in which behaviour (think inheritance) is performed by cloning existing objects (i.e. prototypes). It is also an

View TorqueBox on Heroku.md

With Heroku's JRuby support you may have already seen that you can run TorqueBox Lite on Heroku. But, that only gives you the web features of TorqueBox. What about scheduled jobs, backgroundable, messaging, services, and caching?

With a small amount of extra work, you can now run the full TorqueBox (minus STOMP support and clustering) on Heroku as well! I've successfully deployed several test applications, including the example Rails application from our Getting Started Guide which has a scheduled job, a service, and uses backgroundable and messaging.

This example uses TorqueBox 3.0.2, but the instructions may work with other TorqueBox versions.

Steps Required

  1. Create a JRuby application on Heroku, or convert an existing application to JRuby. Make sure your application works on JRuby on Heroku before throwing TorqueBox into the mix.
  2. Add th
@FaisalAl-Tameemi
FaisalAl-Tameemi / lectures_notes.md
Created Feb 3, 2016
W1D3 Lecture Notes - Arrays, Hashes, Scope
View lectures_notes.md

Data Structures

Arrays

A way of storing lists in Ruby

names = ["Faisal", "Sara", "Jane"]
@jonyt
jonyt / connect_heroku_to_amazon_rds
Last active Apr 13, 2017
How to connect a Heroku application to an Amazon RDS Postgresql instance
View connect_heroku_to_amazon_rds
Download the certificate with:
`wget -O config/rds-combined-ca-bundle.pem http://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem`
Then connect with:
`postgres://user:password@amazon-host/db_name?sslmode=require&sslrootcert=config/rds-combined-ca-bundle.pem`
References:
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.SSL
https://github.com/jeremyevans/sequel/issues/897
http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
http://dba.stackexchange.com/questions/77811/how-to-connect-to-an-amazon-postgresql-database-using-ssl
@shuhei
shuhei / _config.yml.diff
Created Apr 3, 2012
Add a category index to Octopress
View _config.yml.diff
diff --git a/_config.yml b/_config.yml
index 5c7d335..7ad03bb 100644
--- a/_config.yml
+++ b/_config.yml
@@ -45,7 +45,7 @@ titlecase: true # Converts page and post titles to titlecase
# list each of the sidebar modules you want to include, in the order you want them to appear.
# To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
-default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html]
+default_asides: [asides/recent_posts.html, custom/asides/categories.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.
@kagemusha
kagemusha / gist:1569836
Created Jan 6, 2012
Dump Heroku Postgres DB and load locally
View gist:1569836
Get the Heroku db as detailed here:
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup
1. heroku pgbackups:capture
2. heroku pgbackups:url <backup_num> #=>backup_url
- get backup_num with cmd "heroku pgbackups"
3. curl -o latest.dump <backup_url>
Then locally do:
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump
@fnhipster
fnhipster / html5.haml
Created Apr 9, 2011
HTML5 HAML Template
View html5.haml
!!! 5
%html
%head
%title= "Your Website"
%meta{ :content => "", :name => "description" }
%meta{ :content => "", :name => "author" }
%meta{ :content => "3 days", :name => "revisit-after" }
%link{ :href => "http://creativecommons.org/licenses/by/3.0/", :rel => "license", :title => "Creative Commons Attribution 3.0 Unported License" }
%link{ :href => "/feed", :rel => "alternate", :title => "Atom", :type => "application/atom+xml" }
%link{ :href => "/css/screen.css", :media => "screen", :rel => "stylesheet" }
@velenux
velenux / rails-puma.service
Created Jun 3, 2015
systemd service to start rails/puma
View rails-puma.service
# based on https://gist.github.com/twtw/5494223
# create systemd service file for rails/puma startup
# 0. [if required: rvm use ruby@default]
# 1. rvm wrapper default systemd rails
# 2. put this file in /etc/systemd/system/rails-puma.service
# 3. systemctl enable rails-puma
# 4. systemctl start rails-puma
[Unit]
Description=Rails-Puma Webserver