Skip to content

Instantly share code, notes, and snippets.

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

Chris Fidao fideloper

🏠
Working from home
View GitHub Profile
@fideloper
fideloper / config.app.php
Created July 18, 2012 18:26
Master-Slave database in CodeIgniter
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//Create a new config file
/*
|--------------------------------------------------------------------------
| Number of databases in use
|--------------------------------------------------------------------------
|
| Using a Master and Slave. The Slave doubles as a read-only database.
@fideloper
fideloper / post_image.php
Created August 2, 2012 19:18
Facebook Code Snippets
<?php
/*
Note that this does not use app icons or links in Timeline post. Some messaging is therefor lost.
*/
require 'fb/src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'SOME_APP_ID',
@fideloper
fideloper / find.sh
Created September 12, 2012 15:20
Find 'print_r' in php files, with file name and line number
#Reference: http://stackoverflow.com/questions/7600313/find-command-that-returns-line-number-of-the-string
find . -name '*.php' -print | xargs grep -Hn 'print_r'
@fideloper
fideloper / .gitconfig
Last active October 23, 2018 07:52
Git aliases
[alias]
#Basic
st = status -sb
co = checkout
#Flow
fs = flow feature start
ff = flow feature finish
#Infoz
@fideloper
fideloper / cleanmac.sh
Created September 24, 2012 18:33
Clean mac files from linux
#!/bin/bash
function show_usage {
echo "Use to clean .DS_Store and ._* files which macintosh loves to add to your file system."
echo "This works recursively"
echo "Usage: $ cleanmac /path/of/dir"
echo "Defaults to current directory '.' "
exit 1
}
@fideloper
fideloper / MongoDB Backup Script
Created September 28, 2012 21:35 — forked from wahyusumartha/MongoDB Backup Script
MongoDB Backup Script
#!/bin/bash
#!/usr/bin/env ruby
#########################################
# Define source and destinations
MONGO_DBS=""
BACKUP_TMP=~/tmp
BACKUP_DEST=~/backups
MONGODUMP_BIN=/Users/wahyusumartha/Documents/mongodb-db/bin/mongodump
TAR_BIN=/usr/bin/tar
@fideloper
fideloper / sphinx.conf
Created October 3, 2012 01:15
Install Sphinx and php .so in Ubuntu 12.04
#############################################################################
## data source definitions
#############################################################################
source users
{
# data source type. mandatory, no default value
# known types are mysql, pgsql, mssql, xmlpipe, xmlpipe2, odbc
type = mysql
@fideloper
fideloper / gitflow.sh
Created October 10, 2012 15:54
Gitflow
#
# Scenario: On develop branch, need to work on 'something'
#
# Create a new feature branch to work on 'something'
$ git flow feature start something
### ...work, add, commit, repeat...
# Finished the 'something' work
$ git flow feature finish something
@fideloper
fideloper / ci_style_guide.md
Created October 10, 2012 23:44
CodeIgniter Style Guide

CodeIgniter Style Guide

This is collectively being called a style guide, however it serves as a standard to enforce a stricter and more enforced methodology in how programming should be done in CodeIgniter.

Why

CodeIgniter is powerful. CodeIgniter is hugely popular. It's popular because it's easy. It's easy because there are many ways to accomplish a task.

CodeIgniter is terrible for the exact reasons which make it powerful. You can too easily place code in a confusing place, or not separate concerns, thus creating programming challenges down the line. It's noob-friendly, which means it's inherently easy to make noob mistakes.

This document serves to restrict coding practices within CodeIgniter with the purpose of making an application with more class (pun without-a-doubt, most-strongly intended).

@fideloper
fideloper / sphinx.md
Created October 25, 2012 00:06
Using Sphinx Search

Separate blog posts:

  1. Installation (Ubuntu)
  2. Configuration
  3. Usage in code