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
### | |
Lightweight Backbone Cache | |
Mike Knoop, 2012 (knoopgroup.com, zapier.com) | |
Simply execute this script file sometime after you load Backbone. | |
It hooks into the Backbone sync function to give a lightweight local | |
cache for models and collections. Will work for both models and collections. | |
Only GET requests are eligible for cacheing and caches are stored by URL. |
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
define([ | |
'jquery', | |
'use!underscore', | |
'use!backbone', | |
'mustache', | |
'text!template/__init__.html', | |
'model/account', | |
'view/header', | |
'view/footer', | |
'view/zaps/__init__', |
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
define([ | |
'jquery', | |
'use!underscore', | |
'use!backbone', | |
'mustache', | |
'text!template/zaps/__init__.html', | |
], | |
($, _, Backbone, MustacheWrapper, InitTemplate) -> | |
ZapsView = Backbone.View.extend |
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
"browser_action": { | |
"default_icon": "icon_16.png", | |
"popup": "popup.html" | |
}, |
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
initRules: () -> | |
# Rules are children of reads. Setup the @rules collection, set a URL on the collection. | |
# then fetch all the children from the api | |
@rules = new Rules({}) | |
@rules.url = () -> | |
return "#{@url()}/rules" |
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
// An invalid domain. | |
// http://emailpie.com/v1/[email protected] | |
{ | |
"didyoumean": null, | |
"errors": [ | |
{ | |
"message": "No MX records found for the domain.", | |
"severity": 7 | |
} |
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
require.config( | |
baseUrl: '/static/js/src', | |
paths: | |
app: 'app', | |
backbone: '../external/backbone/0.9.2/backbone', | |
backboneanalytics:'../external/backbone/analytics/0.0.2/backboneAnalytics' | |
backbonecache: 'backbone/cache/backboneCache', # coffee compiled | |
cookie: '../external/jquery/cookie/1.0.0/cookie', | |
error: 'error/error', # coffee compiled | |
escapesel: '../external/jquery/escapeSel/1.0.0/escapeSel', |
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
appDir: "", # path relative to baseUrl where the app lives. Our app lives at the baseUrl so this is blank | |
baseUrl: "../../src/", # app path relative to the location of THIS build profile file. | |
dir: "../../build", # directory to put all the files in while build is happening (it shouldn't exist before build) | |
mainConfigFile: 'main.js', # make sure this matches the module below | |
modules: [ | |
{ | |
name: "main" # presumes your app config is in a file called main.js | |
} | |
] |
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
# | |
# core | |
from 'log' import log | |
from 'jquery' import $ | |
from 'underscore' import _ | |
from 'backbone' import Backbone | |
from 'handlebars' import Handlebars | |
# iterator: use to truthy-test filter function to iterate over a backbone collection, only rendered those | |
# which pass the truthy-test |
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
//open connection | |
$ch = curl_init(); | |
//set the url, number of POST vars, POST data | |
$fields = array('data' => $variable); | |
curl_setopt($ch,CURLOPT_URL, $url); | |
curl_setopt(CURLOPT_HTTPHEADER, array('Content-Type' => 'application/json')); | |
curl_setopt(CURLOPT_POST, true); | |
curl_setopt(CURLOPT_POSTFIELDS, $fields ); |
OlderNewer