# This example does an AJAX lookup and is in CoffeeScript
$('.typeahead').typeahead(
# source can be a function
source: (typeahead, query) ->
# this function receives the typeahead object and the query string
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/bash | |
# ------------------------------------------------------------ | |
# Bash script to download the latest versions of the | |
# frequently used javascript libraries | |
# | |
# - /jquery/jquery.js|jquery.min.js | |
# - /backbone/backbone.js|backbone.min.js | |
# - /underscore/underscore.js|underscore.min.js | |
# |
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 | |
use \Doctrine\ORM; | |
class RayTemp_Auth_MySQLAuthAdapter implements Zend_Auth_Adapter_Interface { | |
private $username; | |
private $password; | |
public function __construct($username, $password) { | |
$this->username = $username; | |
$this->password = $password; |
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
// includes bindings for fetching/fetched | |
PaginatedCollection = Backbone.Collection.extend({ | |
initialize: function() { | |
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage'); | |
this.page = 1; | |
}, | |
fetch: function(options) { | |
options || (options = {}); | |
this.trigger("fetching"); |
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
requirejs.config({ | |
appDir: ".", | |
baseUrl: "js", | |
paths: { | |
/* Load jquery from google cdn. On fail, load local file. */ | |
'jquery': ['//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min', 'libs/jquery-min'], | |
/* Load bootstrap from cdn. On fail, load local file. */ | |
'bootstrap': ['//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min', 'libs/bootstrap-min'] | |
}, | |
shim: { |
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 | |
require 'vendor/autoload.php'; | |
$app = new \Slim\Slim(); | |
$app->add(new \Slim\Middleware\SessionCookie(array('secret' => 'myappsecret'))); | |
$authenticate = function ($app) { | |
return function () use ($app) { | |
if (!isset($_SESSION['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
public function Output($name = '', $dest = false) { | |
// close the pdf and clean up | |
$this->_cleanUp(); | |
// if on debug mode | |
if ($this->_debugActif) { | |
$this->_DEBUG_add('Before output';); | |
$this->pdf->Close(); | |
exit; | |
} |
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
namespace.views.MyWizard = Backbone.Views.extend({ | |
initialize: function() { | |
_.bindAll(this, 'render', 'wizardMethod'); | |
} | |
render: function() { | |
this.wizardMethod(); | |
return this; | |
}, |
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
_.extend Backbone.Validation.callbacks, | |
valid: (view, attr, selector) -> | |
control = view.$('[' + selector + '=' + attr + ']') | |
group = control.parents(".control-group") | |
group.removeClass("error") | |
if control.data("error-style") == "tooltip" | |
# CAUTION: calling tooltip("hide") on an uninitialized tooltip | |
# causes bootstraps tooltips to crash somehow... | |
control.tooltip "hide" if control.data("tooltip") |
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
<!-- Full Name --> | |
<div class="control-group"> | |
<label class="control-label" for="name">Full Name</label> | |
<div class="controls"> | |
<div class="input-prepend"> | |
<span class="add-on"> | |
<i class="icon-certificate"></i> | |
</span> | |
<input id="name" name="clients[name]" type="text" class="input" placeholder="Allied Insurance" data-error-style="inline"> | |
</div> |