Skip to content

Instantly share code, notes, and snippets.

View patrickmaciel's full-sized avatar
🙏
Jesus is coming!

Patrick Maciel patrickmaciel

🙏
Jesus is coming!
View GitHub Profile
@Zoramite
Zoramite / maintenance.sh
Created March 14, 2012 21:25
Git Maintenance Commands
# Verifies the connectivity and validity of the objects in the database
git fsck —unreachable
# Manage reflog information
git reflog expire —expire=0 —all
# Pack unpacked objects in a repository
git repack -a -d -l
# Prune all unreachable objects from the object database
@peymano
peymano / gist:2047968
Created March 16, 2012 00:47
Restore from a binary Postgres dump file
pg_restore --clean --no-acl --no-owner -d <database> -U <user> <filename.dump>
@LordGaav
LordGaav / post-commit
Created June 19, 2012 11:59
Git hook that determines the author based on the email address in a SSH key. Doesn't work because Git doesn't check the config between pre-commit and commit.
#!/bin/sh
# Retrieve author information as Git sees it while commiting
AUTHORINFO=$(git var GIT_AUTHOR_IDENT) || exit 1
NAME=$(printf '%s\n' "${AUTHORINFO}" | sed -n 's/^\(.*\) <.*$/\1/p')
EMAIL=$(printf '%s\n' "${AUTHORINFO}" | sed -n 's/^.* <\(.*\)> .*$/\1/p')
printf "AUTHORINFO: %s\n" "${AUTHORINFO}"
printf "NAME: %s\n" "${NAME}"
printf "EMAIL: %s\n" "${EMAIL}"
@RaVbaker
RaVbaker / gist:2967695
Created June 21, 2012 18:44
[HOWTO] Ubuntu 12.04 Ruby on Rails Development Environment

Ubuntu 12.04 Ruby on Rails Development Environment

I haven't set up an install guide for the latest ubuntu release, largely because the last set of instructions worked pretty closely with the latest and greatest Ubuntu, 12.04 Precise Pangolin, however when installing today, I found that there were enough differences in the way that I configure my setup to justify an update, so here it goes. Yes, I'm late to the party, but a quick google search didn't find anything that I felt was as complete for my requirements as my previous install guides, so here I go.

As always with my install guides, I have included here is just about everything you'll need (and then some) to get started with ruby on rails development with Ubuntu 12.04 as a platform. These are my settings and preferences, and this is certainly not the only way of doing things, so keep that in mind.

Step 1: Get the repos ready and run updates.

sudo apt-get update && sudo apt-get upgrade
@johanmeiring
johanmeiring / gist:3002458
Created June 27, 2012 08:32
"git lg" alias for pretty git log
# From http://garmoncheg.blogspot.com/2012/06/pretty-git-log.html
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
@tmaiaroto
tmaiaroto / virtual.conf
Created August 9, 2012 18:48
Nginx Virtual Host Setup for OS X using Homebrew
#
# A virtual host using mix of IP-, name-, and port-based configuration.
# This is based on using Homebrew for OS X. You can use this in other
# cases though, but you'll likely need to adjust some of the paths below.
#
server {
# Replace this port with the right one for your requirements
# listen 80 [default|default_server]; #could also be 1.2.3.4:80
@erkobridee
erkobridee / rest-json-js-frontend.md
Last active November 8, 2024 11:22
links úteis REST, JSON, HTML5, JavaScript e Twitter Bootstrap

Links úteis

  • A Rant about Estimation – When Will We Stop Being Crazy

  • InfoQ BR

    • Fuja da escravidão antes que ela te alcance - Nesta palestra, Vinícius Teles nos fala a respeito da realidade de muitos trabalhadores que possuem vidas estáveis, porém repletas de frustrações advindas de suas rotinas e carreiras aparentemente seguras. Vinícius trata do empreendedorismo, com dicas para profissionais de tecnologia que buscam atingir não apenas a estabilidade financeira, mas também a plena satisfação profissional e pessoal.

    • Agile Brazil 2012

@felquis
felquis / busca.js
Created October 4, 2012 16:37
Busca por string em uma string que representa um JSON.
// Buscar o que?
var busquePor = '',
json = "{1:'Ofelquis',2:'Diego',3:'Vanessa',4:'Rennan',5:'Thiago',6:'André',7:'Caio',8:'Vagner',9:'Lucio',10:'Dhiego'}",
regex = RegExp('[^{:,]+:[\'"]([^\'"]*' + busquePor + '[^\'"]*)[\'"]', 'gi'),
html = '';
json.match(regex).forEach(function (a) {
html += a+'<br />';
});
INSERT INTO `states` (`id`, `name`, `code`) VALUES (1, 'Acre', 'AC');
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Acrelândia', -9.825808, -66.897166);
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Assis Brasil', -10.929765, -69.573794);
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Brasiléia', -10.994994, -68.749696);
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Bujari', -9.815277, -67.955029);
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Capixaba', -10.566031, -67.686006);
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Cruzeiro do Sul', -7.627625, -72.675582);
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Epitaciolândia', -11.018771, -68.734109);
INSERT INTO `cities` (`state_id`, `name`, `latitude`, `longitude`) VALUES (1, 'Feijó', -8.170536, -70.350973);
INSERT INTO `cities` (`
@JeffreyWay
JeffreyWay / laravel4.md
Created November 19, 2012 16:37
Laravel 4 Thoughts/Questions/Etc.

Laravel 4 Thoughts/Questions/Etc.

This is just a random list of notes, as I dig into Laravel 4. If you have any feedback/solutions, please leave a comment. I'll be compiling everything for an article on Nettuts+, when the framework is officially in Beta. This will be updated over the course of the week.

  • Running composer dump-autoload after every new controller is a pain. Can this not be automated through artisan controller:make ControllerName?

  • Seems that some of the View HTML helpers are missing. No HTML::script().

  • Route::resource('tasks', 'TasksController') doesn't seem to create named routes. This is a big deal, if not. What's the solution?