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
<?php | |
// PHP pimple | |
$container = new Pimple(); | |
$container['ActiveFeed'] = $container->share(function($c){ | |
return new MyActiveFeed($c['MyModel'], $c['TestService']); | |
}); | |
// angularjs | |
angular.module('News').factory 'ActiveFeed', ['MyModel', 'TestService', (MyModel, TestService)-> | |
return new MyActiveFeed(MyModel, TestService) |
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 Promise(){ | |
this.requestIsSuccess = false; | |
this.onSuccessCallback = false; | |
} | |
Promise.prototype.success = function(callback){ | |
if(this.requestIsSuccess){ | |
callback(this.data) | |
} else { | |
this.onSuccessCallback = callback; |
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
for(var i=0; i<10; i++){ | |
$elem = $("<p>"); | |
$elem.click(function(){ | |
alert(i); // alerts 9 every time the element is being clicked | |
}); | |
$(document).append($elem); | |
} | |
// solution | |
for(var i=0; i<10; i++){ |
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
<?php | |
require __DIR__ . '/autoloader.php'; | |
// without Pimple | |
$route = new Route(); | |
$route->add('/blog/.+/.+', function($ownerId, $postId) { | |
$db = new PDOSomething('user', 'pass', 'db'); // instantiate db | |
$mapper = new BlogPostMapper($db); | |
$controller = new BlogPostController($mapper); |
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 app = angular.module('Mail', ['OC']); | |
app.controller('MyController', ['$scope', 'Request', function($scope, Request){ | |
$scope.doARequest = function(){ | |
Request.get('mail_all'); | |
} | |
}]); |
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
editable:hover span { | |
display: none; | |
} | |
editable span.editing { | |
display: none; | |
} | |
editable input { | |
display: none; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en"> | |
<title type="html">Demo feed</title> | |
<subtitle type="html">Strip out JS demo feed</subtitle> | |
<link rel="self" type="application/atom+xml" href="https://gist.github.com/cosenal/" /> | |
<link rel="alternate" type="text/html" href="https://gist.github.com/"/> | |
<id>https://gist.github.com/</id> | |
<updated>2015-02-11T16:22:02+01:00</updated> | |
<entry> | |
<title type="html">Demo entry</title> |
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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<import> | |
<item type="Product"> | |
<property name="europe1Prices"> | |
<item type="PriceRow"> | |
<property name="pdtType" val="gold"/> | |
<property name="price" val="$source['pricecolumnname']"/> | |
</item> | |
</property> | |
</item> |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"><head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
<style type="text/css"> | |
body {background-color: #fff; color: #222; font-family: sans-serif;} | |
pre {margin: 0; font-family: monospace;} | |
a:link {color: #009; text-decoration: none; background-color: #fff;} | |
a:hover {text-decoration: underline;} | |
table {border-collapse: collapse; border: 0; width: 934px; box-shadow: 1px 2px 3px #ccc;} | |
.center {text-align: center;} |