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
ALTER TABLE `contacts` ADD FULLTEXT `search` (`first`,`last`,`email`); |
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
CREATE FULLTEXT INDEX `contacts` ON `search` (`first`, `last`, `email`, `phone`); |
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
function get_card($card_id) | |
{ | |
$card = Card::find($card_id); | |
$data = array( | |
'json_card' => json_encode($card), | |
); | |
$this->layout->nest( 'content', 'card.form_editor', $data ); | |
} |
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
// Check your crontab | |
crontab -l | |
// Edit your crontab and set [email protected] | |
crontab -e | |
// Getting permission denied on the bash you're trying to run? | |
chmod -c 777 backupSql.sh | |
// Change your crontab to run one minute in the future |
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
// Source: http://javascriptweblog.wordpress.com/2010/12/07/namespacing-in-javascript/ | |
var myApp = (function() { | |
var id= 0; | |
return { | |
next: function() { | |
return id++; | |
}, |
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
public static function read_search($terms, $limit = 20) | |
{ | |
$contact_results = Contact::where_account_user_id(Auth::user()->account_user_id) | |
->where_deleted(0) | |
->where_marketing(0) | |
->where_mass_merge(0) | |
->raw_where("match (`first`, `last`) against (?)", array($terms)) | |
->take($limit) | |
->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
<?php | |
// http://ideone.com/JWKIf | |
function is_64bit() { | |
$int = "9223372036854775807"; | |
$int = intval($int); | |
if ($int == 9223372036854775807) { | |
/* 64bit */ | |
return true; |
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 | |
$users = User::all(); | |
foreach ($users as {{4}}) { | |
$user{{2}}name; | |
} | |
?> | |
/* |
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
<h1>dataCodeBlock, an automagical code block generator</h1> | |
<p>When documenting style guides, maintaining parity between your "living" demos and code samples can be a pain in the butt. dataCodeBlock automates that.</p> | |
<h2>Demo</h2> | |
<ul data-codeblock="#target-div"> | |
<li>This <code>UL</code> uses the <code>data-codeblock</code> attribute</li> | |
<li>It targets the <code>#target-div</code> selector and appends there.</li> | |
<li>The output generated code block removes the attribute.</li> | |
</ul> |
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
/* | |
Note the white space in the $page variable. | |
$page is set somewhere up here and is being concatenated upon. | |
These units are in bytes. | |
Sourced from: http://stackoverflow.com/questions/2192657/how-to-determine-the-memory-footprint-size-of-a-variable | |
*/ | |
// WITHOUT WHITE SPACE: http://screencloud.net/img/screenshots/e5c9b31c4b20021082c22a551fca903c.png | |
$start_memory = memory_get_usage(); |
OlderNewer