This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('sql')) { | |
function sql($detailed = false) { | |
if ($detailed) { | |
Event::listen("illuminate.query", function($query, $bindings, $time, $name) { | |
$queries = DB::getQueryLog(); | |
echo '<pre>'; | |
foreach(end($queries) as $item) { | |
var_dump($item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Icons with edit class will convert their data partner to an input | |
$('i.edit').click(function() { | |
var table = $(this).data('table'); | |
var column = $(this).data('column'); | |
var relation = $(this).data('relation'); | |
var id = $(this).data('id'); | |
var type = $(this).data('type'); | |
var morph = $(this).data('morph'); | |
var original_elem = $(this).siblings('span'); | |
var original_text = original_elem.text(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return a url segment | |
* @param {Integer} url segment wanted | |
* @return {String} URL segment | |
*/ | |
function get_path_segment(num) { | |
return location.pathname.split("/")[num].toLowerCase(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Email a URL to colleague so he can visit the Admin sessions page | |
// Current page: /admin/sessions (GET route) | |
$type = 'type'; | |
$start_date = '2012-01-01'; | |
$end_date = '2012-03-01'; | |
$session_id = '123456'; | |
$url = 'http://domain.com/admin/sessions?type=' . urlencode($type); | |
$url .= '&start_date=' . urlencode($start_date); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add /app/config/database.php into the project folder .gitignore | |
Then remove it from the staging area cache with: | |
git rm --cached app/config/database.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit colors="true" | |
processIsolation="true" | |
verbose="true" | |
debug="true"> | |
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace SS\Stock; | |
use DB, File, Cache, Input, Response; | |
class Stock { | |
public function __construct() | |
{ | |
ini_set("memory_limit", "-1"); | |
set_time_limit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace SS\Stock; | |
use DB, File, Cache; | |
class Stock { | |
public function __construct() | |
{ | |
ini_set("memory_limit", "-1"); | |
set_time_limit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class StoringController extends BaseController { | |
public function store_streaks() | |
{ | |
$date = date('Y-m-d'); | |
$stocks = DB::table('stocks')->select('symbol')->orderBy('symbol', 'asc')->get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I didn't write this function, only modified it slightly. It works well though! | |
function valid_url(str) { | |
var pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol | |
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name | |
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address | |
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path | |
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string | |
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator |