Skip to content

Instantly share code, notes, and snippets.

View sebacruz's full-sized avatar
🤖

Sebastián Cruz sebacruz

🤖
View GitHub Profile
#!/bin/bash
# remove __MACOSX foldr and .DS_Store files
# from *_original.zip file
# zip again and place under fixed/*
for x in $*
do
unzip $x
@sebacruz
sebacruz / Homebrew.md
Created September 17, 2013 14:38 — forked from erutan/Homebrew.md

Installing a custom MAMP environment on OS X via Homebrew

Prerequisites

Xcode

Go to http://developer.apple.com/downloads, log in with your Apple ID (free) and download the newest version of either Command Line Tools (OS X Lion) for Xcode or Command Line Tools (OS X Mountain Lion) for Xcode. Run the installer in the dmg and you'll have the LLVM compiler, make, and other build tools.

XQuartz

@sebacruz
sebacruz / rest.php
Created September 11, 2013 18:04 — forked from cambiata/rest.php
<?php
/**
* Quickly assemled rest controller based on Kohana 3's Kohana_Controller_REST
* https://github.com/kohana/core/blob/3.1%2Fmaster/classes/kohana/controller/rest.php
*
* Added functionality from FuelPHP's Controller_Rest
* https://github.com/fuel/fuel/blob/develop/fuel/core/classes/controller/rest.php
*
* All credits to Kohana and FuelPHP teams!
* Jonas Nyström - cambiata
//This is the Backbone controller that manages the content of the app
var Content = Backbone.View.extend({
initialize:function(options){
Backbone.history.on('route',function(source, path){
this.render(path);
}, this);
},
//This object defines the content for each of the routes in the application
content:{
"":_.template(document.getElementById("root").innerHTML),
@sebacruz
sebacruz / fb-base.js
Created July 18, 2013 20:18
JS general para tabs de Facebook.
<div id="fb-root"></div>
<script src="//connect.facebook.net/es_LA/all.js#xfbml=1"></script>
<script>
// Facebook instance
FB.init({
appId: Settings.facebook.appId,
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
oauth: true, // enable OAuth 2.0
# Replace any brackets with real values
# Try to ssh in to DREAMHOST (ensure it no longer asks for a PW); you may want to restart Terminal
ssh [user]@[host]
cd ~
mkdir [mydomain_com].git
cd [mydomain_com].git
git init --bare
vi hooks/post-receive
# Enter the code from the "post-receive" file (in this gist); save + quit
/**
* Centers an element
*
* @param element Element to center
*/
;(function($){
$.fn.centered = function(){
return this.each(function(){
var element = $(this),
parent = element.parent();
@sebacruz
sebacruz / json_readable_encode.php
Created May 3, 2013 01:35
Encode an array (or object) as a json string, but with indentation so that i can be easily edited and read by a human
<?php
/*
json readable encode
basically, encode an array (or object) as a json string, but with indentation
so that i can be easily edited and read by a human
THIS REQUIRES PHP 5.3+
Copyleft (C) 2008-2011 BohwaZ <http://bohwaz.net/>
<?php
/**
* Return a singular or plural string based on the count provided
*
* @param string $singular The singular form
* @param string $plural The plural form
* @param string $count The count
* @return string The appropriately translated string
*/
function plural($singular, $plural, $count) {
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.