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('plunker', []); | |
app.controller('MainCtrl', function($scope) { | |
$scope.name = 'World'; | |
}); |
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
window.stoppingPropagation = (callback) -> (e) -> | |
e.stopPropagation() | |
callback(e) | |
angular.module('myApp',[]).directive 'ngTap', -> | |
(scope, element, attrs) -> | |
tapping = false | |
element.bind 'touchstart', stoppingPropagation (e) -> tapping = true | |
element.bind 'touchmove', stoppingPropagation (e) -> tapping = false | |
element.bind 'touchend', stoppingPropagation (e) -> scope.$apply(attrs['ngTap']) if tapping |
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
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
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
<label>Título: </label> | |
<input type="text" name="titulo" ng-model="question.title"> | |
<label>Respuestas: </label> | |
<ul ng-repeat="answer in answers" ng-model="answers"> | |
<li>{{answer.title}}</li> | |
</ul> | |
<input type="text" name="answer" ng-model="answer"> |
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
the basics of programming with callbacks: | |
structure: | |
function simple1(cb) // the last argument is callback function | |
{ | |
if(cb)return cb();// the return is required to prevent continuation of the function | |
} | |
to make a function asynchronous: add cb as last argument. | |
put at the end: if(cb)return cb(); |
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 | |
/* | |
* | |
* Uploaded by Rajah Oshimin | |
* Udated from : http://cloudsherpaz.wordpress.com/2013/01/05/migrate-mysql-database-to-mongodb/ | |
* | |
*/ | |
// genghis is a single-file MongoDB admin application. | |
// Located at http://genghisapp.com/ |
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
the basics of programming with callbacks: | |
structure: | |
function simple1(cb) // the last argument is callback function | |
{ | |
if(cb)return cb();// the return is required to prevent continuation of the function. | |
// the if(cb) is optional and it is to enable to omit the callback in rare cases. it is usually useful in api functions. | |
} | |
to make a function asynchronous capbl;e: |
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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, http = require('http'); | |
var app = express(); | |
var server = app.listen(3000); |
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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, http = require('http'); | |
var app = express(); | |
var server = app.listen(3000); |
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
/** | |
* Module dependencies. | |
*/ | |
var express = require('express') | |
, routes = require('./routes') | |
, http = require('http'); | |
var app = express(); | |
var server = app.listen(3000); |