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() { | |
var cache = {}; | |
this.tmpl2 = function tmpl(str, data) { | |
// Figure out if we're getting a template, or if we need to | |
// load the template - and be sure to cache the result. | |
var fn = !/\W/.test(str) ? | |
cache[str] = cache[str] || | |
tmpl(document.getElementById(str).innerHTML) : |
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() { | |
this.tmpl3 = function tmpl(str, data) { | |
var value = "var out = ''; out+=" + "'" + | |
str.replace(/[\r\t\n]/g, " ") | |
.replace(/'(?=[^%]*%>)/g,"\t") | |
.split("'").join("\\'") | |
.split("\t").join("'") | |
.replace(/<%=(.+?)%>/g, "'; out += $1; out += '") | |
.split("<%").join("';") |
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
// Active Record | |
var User = Model.define( { | |
id: "UserID", | |
transport: { | |
create: "create.php" | |
} | |
}); | |
var user = new User(); | |
user.set($("form").serialize()); |
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
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load | |
Me.litSalesGridDataSource.Text = "<script>" & vbCrLf & _ | |
"var oSales = [" & vbCrLf | |
For i As Int32 = 1 To 5 | |
Select Case i | |
Case Is = 1 | |
Me.litSalesGridDataSource.Text &= "{" & vbCrLf & _ | |
"""SaleID"": """ & i & """," & vbCrLf & _ | |
"""SaleDate"": """ & Format(CDate("01-Jan-2012"), "MM/dd/yyyy") & """," & vbCrLf & _ |
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
$.ajax({ | |
url: "http://example.com", | |
type: "POST", | |
data: '{"sqlcmd":"SELECT TOP 10 FROM table"}', | |
contentType: "application/json; charset=utf-8", | |
}); |
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
var children = []; | |
for (var i = 0; i < a.length; ++i) { | |
children[i] = dom("li", a[i]); | |
} | |
return dom("ul", children); |
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($, undefined) { | |
$.ui5 = $.ui5 || {}; | |
function DataSource(options) { | |
var that = this; | |
that.idMap = {}; | |
$.extend(that, options); | |
} |
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
interface Car { | |
} | |
interface Bus { | |
} | |
type Vehicle = Car | Bus; | |
function drive(vehicle: Vehicle): void { | |
switch (vehicle) { |
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 update(req, res) { | |
const { id, name, saying } = req.body; | |
Hero.findOne({ id }, (err, hero) => { | |
if (err) { | |
res.status(500).send(err); | |
} else if (!hero) { | |
res.status(500).send("Hero not found"); | |
} else { | |
hero.name = 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
function update(req, res) { | |
const { id, name, saying } = req.body; | |
Hero.findOne({ id }) | |
.then(hero => { | |
hero.name = name; | |
hero.saying = saying; | |
hero.save().then(() => res.json(hero)) | |
}) | |
.catch(err => { |