Skip to content

Instantly share code, notes, and snippets.

View marceloandrader's full-sized avatar
🏠
Working from home

Marcelo Andrade marceloandrader

🏠
Working from home
View GitHub Profile
<?php
require 'vendor/autoload.php';
$template = [
'keys[]' => new mef\Validation\TypedArray(
new mef\Validation\SanitizationChain(
[
new mef\Validation\DefaultValue('false'),
new mef\Validation\Boolean()
#!/bin/bash
# to create migrations files based on time
# parameter should be the name of the migration
# usage:
# ./create_migration.sh add_fields_to_table
touch `date -u +%Y%m%d%H%M%S_`$1.sql%
@marceloandrader
marceloandrader / .gitconfig
Created October 13, 2011 18:12
misc trips & tricks
[user]
name = Marcelo Andrade
email = [email protected]
[core]
editor = mate -w
[alias]
com = commit
co = checkout
st = status
br = branch
@marceloandrader
marceloandrader / snippets.m
Created October 7, 2011 15:46
ios snippets
// For trace where an object is being released
- (void)release {
NSLog(@"%@",[NSThread callStackSymbols]); // Print the stack trace
[super release]; //Set breakpoint here
}
@marceloandrader
marceloandrader / ios_sdk_download.sh
Created September 30, 2011 16:27
Download ios sdk with wget
# First need to install cookie exporter on firefox
# Enter to the developer site
# Try to download the file
# Copy the url from the downloads
# Export the cookies.txt file
# Then run this command
wget --limit-rate=50k --server-response --continue --no-check-certificate --load-cookies=cookies.txt http://adcdownload.apple.com/Developer_Tools/xcode_4.1_for_snow_leopard_21110/xcode_4.1_for_snow_leopard.dmg
@marceloandrader
marceloandrader / mail.php
Created August 17, 2011 15:06
Replace sendmail script for avoid sending mails to real people on dev
#!/usr/local/bin/php
<?php
$email = file_get_contents('php://stdin');
$email = preg_replace('/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/', '<email_you_want_to_redirect>', $email);
//var_dump($email);
//exit;
$fd = popen("/usr/sbin/sendmail -t","w") or die("Couldn't Open Sendmail");
@marceloandrader
marceloandrader / README.md
Created August 3, 2011 17:08
external diff for git on mac
git config --global diff.external ~/[PATH]/opendiff-git.sh
{
"event_id": 1,
"survey": {
"title": "Survey 1",
"description": "Description 1",
"questions": [{
"question_id": 1,
"title": "Question 1",
"description": "Desc Question 1",
"question_type": "simple",
@marceloandrader
marceloandrader / commit-msg.rb
Created May 17, 2011 17:15
commit-msg for xtimes
#!/usr/bin/env ruby
# Author: Marcelo Andrade
# this hook check the validity of a commit message in the format we
# can input to xtimes to create a valid event tagged with the tasks
# we are working on
# INSTALLATION
# Copy this file in each repo in the hooks directory and give execution permission:
@marceloandrader
marceloandrader / convert.sh
Created April 26, 2011 21:01
convert a file from divx to mpeg1 to reproduce on sony 32bx300
#!/bin/bash
INPUT_FILE=$1
SUB_FILE=$2
OUTPUT_FILE=$3
mencoder $INPUT_FILE -sub $SUB_FILE -o $OUTPUT_FILE -ofps 25 -vf scale=1280:720 -of lavf \
-lavfopts format=mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg1video:vrc_buf_size=1835:keyint=15:vrc_maxrate=1152:vbitrate=1152:vmax_b_frames=0:aspect=16/9 \
-of mpeg