This file contains hidden or 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
var Request = unirest.get('https://api.twitter.com/oauth/request_token'); | |
Request.oauth({ | |
callback: 'http://mysite.com/callback/' | |
, consumer_key: 'CONSUMER_KEY' | |
, consumer_secret: 'CONSUMER_SECRET' | |
}).end(function (response) { | |
var access_token = response.body; | |
Request = unirest.post('https://api.twitter.com/oauth/access_token'); |
This file contains hidden or 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 | |
App::uses('Component', 'Controller'); | |
class LanguageComponent extends Component { | |
public function initialize(Controller $controller) { | |
$this->autoSelectLanguage($controller); |
This file contains hidden or 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 | |
/** | |
* Formats form elements for Bootstrap v3 | |
* | |
* Add to AppController.php | |
* | |
* public $helpers = array( | |
* 'Form' => array('className' => 'BootstrapForm') | |
* ); |
This file contains hidden or 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 function getLastQuery() { | |
$dbo = $this->getDatasource(); | |
$logs = $dbo->getLog(); | |
$lastLog = end($logs['log']); | |
return $lastLog['query']; | |
} |
This file contains hidden or 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 | |
/** | |
* Shell to reset / create a default admin user | |
* | |
* @source https://gist.github.com/csrui/6279811 | |
* @url http://book.cakephp.org/2.0/en/console-and-shells.html | |
**/ | |
class UserShell extends AppShell { | |
public $uses = array('User'); |
This file contains hidden or 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 | |
/** | |
* MetaBehavior handles a set of fields like meta information for a given model row | |
* | |
* @source https://gist.github.com/csrui/6240411 | |
* @url http://book.cakephp.org/2.0/en/Models/behaviors.html | |
**/ | |
class MetaBehavior extends ModelBehavior { | |
public $settings = array(); |
This file contains hidden or 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 | |
/** | |
* GeoBehavior handles a set of operations generaly needed when working with coordinates | |
* | |
* @source https://gist.github.com/csrui/6173911 | |
* @url http://book.cakephp.org/2.0/en/Models/behaviors.html | |
**/ | |
class GeoBehavior extends ModelBehavior { | |
public $settings = array(); |
This file contains hidden or 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
/* | |
Extended Bootstrap Typeahead | |
Based on an answer on stackexchange.com | |
http://stackoverflow.com/a/14959406/1065537 | |
*/ | |
/* Enhances the autocomplete function */ | |
$('.autocomplete').typeahead({ | |
source: function (query, process) { | |
return $.ajax({ |
This file contains hidden or 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
<div class="pm-widget-calendar"></div> | |
<script> | |
var pm_widget_calendar = { | |
limit : 10, | |
user_id : 1, | |
include_location : false | |
}; | |
</script> | |
<script src="http://cdn.planamatch.com/js/pm.calendar.widget.min.js"></script> |
This file contains hidden or 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
#!/bin/sh | |
cd .. | |
GIT_DIR='.git' | |
umask 002 && git reset --hard | |
# Set 'receive.denyCurrentBranch' configuration variable to 'ignore' or 'warn' in the remote repository to allow pushing into | |
# chmod +x .git/hooks/post-receive |
NewerOlder