Skip to content

Instantly share code, notes, and snippets.

<div class='row-fluid'>
<div class='span12'>
<div data-toggle-name='record_id' value='Hank Williams' class='btn btn-input btn-large'>
Hank Williams
</div>
<div data-toggle-name='record_id' value='Cee Lo Green' class='btn btn-input btn-large'>
Cee Lo Green
</div>
<input type='hidden' name='record_id' value='0'>
@clouddueling
clouddueling / gist:4449335
Created January 4, 2013 02:08
mysqldump.php
<?php
class MySQLDump
{
public $tables = array();
public $connected = false;
public $output;
public $droptableifexists = false;
public $mysql_error;
public $host = "";
@clouddueling
clouddueling / mysqldump.php
Created January 4, 2013 02:10
mysqldump written in php
<?php
class MySQLDump
{
public $tables = array();
public $connected = false;
public $output;
public $droptableifexists = false;
public $mysql_error;
public $host = "";
@clouddueling
clouddueling / README.md
Last active December 10, 2015 18:08 — forked from aronwoost/README.md

Launch the instance and connect with ssh.

##Update the server

sudo yum update

##Install php and MySQL packages

@clouddueling
clouddueling / colors.php
Created January 18, 2013 21:21
an array of colors php
$colors = array(
"Indian Red" => "#CD5C5C",
"Salmon" => "#FA8072",
"Dark Salmon" => "#E9967A",
"Light Salmon" => "#FFA07A",
"Crimson" => "#DC143C",
"Red" => "#FF0000",
"Fire Brick" => "#B22222",
"Dark Red" => "#8B0000",
@clouddueling
clouddueling / fulltext_laravel.php
Created February 1, 2013 03:39
A better fulltext search for laravel returning eloquent objects
public static function search_contacts($terms)
{
$terms = mysql_real_escape_string($terms);
$contact_results = Contact::where_account_user_id(Auth::user()->account_user_id)
->raw_where("match (`first`, `last`) against ('{$terms}*' IN BOOLEAN MODE)")
->where_deleted(0)
->paginate(20);
phpconsole($contact_results->results);
@clouddueling
clouddueling / multi_coloumn_search.php
Created February 5, 2013 14:53
multi column sorted fulltext search
public static function search_contacts($terms)
{
$terms = escape($terms);
$contacts = Contact::where_account_user_id(Auth::user()->account_user_id)
->raw_where("match (`first`, `last`) against ('{$terms}*' IN BOOLEAN MODE)", array())
->where_account_user_id(Auth::user()->account_user_id)
->where_deleted(0)
->take(20)
->get();
@clouddueling
clouddueling / controller.php
Created February 9, 2013 01:54
running a worker with phpconsole and submitting curl requests on the fly
<?php
class Home_Controller extends Base_Controller
{
public function get_run()
{
phpconsole("WORKER: Initializing the CloudWorker.");
$love = true;
@clouddueling
clouddueling / search_with_like.php
Created February 16, 2013 16:43
search table with like using eloquent
public static function search_contacts($terms)
{
$search_all = ! Input::has('first') && ! Input::has('last');
$terms = escape($terms);
$search_terms = explode(' ', $terms);
$search_term_bits = array();
foreach ($search_terms as $term) {
$term = trim($term);
if (! empty($term)) {
if ((Input::has('first') && Input::has('last')) || $search_all)
@clouddueling
clouddueling / helpers.php
Created February 17, 2013 16:29
Shorten Form:: to f:: so you type less over time.
// include this file at bottom of start.php
// if (strlen('Form') * $numberOfFormElements > strlen('f') * $numberOfFormElements)
// return "3x's less keys pushed over time."
class f extends Form {}