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 | |
// SOURCE: http://php.net/manual/en/functions.anonymous.php | |
// A basic shopping cart which contains a list of added products | |
// and the quantity of each product. Includes a method which | |
// calculates the total price of the items in the cart using a | |
// closure as a callback. | |
class Cart | |
{ | |
const PRICE_BUTTER = 1.00; | |
const PRICE_MILK = 3.00; |
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
(function() { | |
var Controller, Events, SuperClass, Web, moduleKeywords, | |
__indexOf = [].indexOf || function(item) { | |
for (var i = 0, l = this.length; i < l; i++) { | |
if (i in this && this[i] === item) | |
return i; | |
} | |
return -1; | |
}, | |
__hasProp = {}.hasOwnProperty, |
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
moduleKeywords = ['included', 'extended'] | |
class SuperClass | |
@include: (obj) -> | |
throw('include(obj) requires obj') unless obj | |
for key, value of obj.prototype when key not in moduleKeywords | |
@::[key] = value | |
included = obj.included | |
included.apply(this) if included |
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
extends layout.jade | |
block content | |
include nav-bar-email | |
.container-fluid | |
.row-fluid | |
.span12 | |
.well | |
i.icon-warning-sign.icon-4x.pull-right |
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
doctype 5 | |
html | |
head | |
link(rel='stylesheet', href='http://domain.com/components/bootstrap/docs/assets/css/bootstrap.css') | |
link(rel='stylesheet', href='http://domain.com/components/bootstrap/docs/assets/css/bootstrap-responsive.css') | |
link(rel='stylesheet', href='http://domain.com/components/font-awesome/css/font-awesome.min.css') | |
script(type="text/javascript", src="http://domain.com/components/jquery/jquery.min.js") | |
script(type="text/javascript", src="http://domain.com/components/bootstrap/docs/assets/js/bootstrap.js") | |
body |
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
#!/usr/bin/env coffee | |
# | |
# incoming argv is order sensitive | |
# | |
# [0] - coffee | |
# [1] - /opt/bin/notify-service.coffee | |
# [2] - hostname | |
# [3] - service | |
# [4] - IP address | |
# [5] - notification type [ PROBLEM, RECOVERY, OK ] |
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
_helper = require '_helper' | |
### | |
completeIssue is a great example of parallel scripting. | |
req | |
- project ObjectId | |
- milestone ObjectId | |
- issue ObjectId |
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
mUpload = (req, res)-> | |
file = req.files["fileForm"] | |
tmpPath = file.path | |
fileName = file.name | |
dest = __dirname + "/#{fileName}" | |
fs.readFile tmpPath, (err, data)-> | |
fs.writeFile dest, data, (err)-> |
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
handler = ()-> | |
document.getElementById("fileField").files | |
# Make sure a file is selected first | |
if files.length <= 0 | |
alert('choose a file, first') | |
return | |
file = files[0] | |
fd = new FormData() |