Add this to a bogart (or express etc.) route to do funky suff. See bogart-blog and just paste this in app.js
.
router.get('/✌☮✔', function (req) {
return 'Freedom and Peace = like!';
});
/* | |
Have a look at these links: | |
https://github.com/amdjs/amdjs-api/wiki/AMD | |
http://requirejs.org/docs/whyamd.html | |
EXAMPLE: | |
*/ | |
define('moduleA', [ /* no dependencies */ ], function() { | |
// Here we are inside the callback function body. This is called by AMD. |
(function() { | |
var test, something; | |
function privateFunc() { | |
}; | |
var myObject = { | |
myMethod: function() {privateFunc.apply(this, []);} | |
}; | |
/** | |
* This method will calculate the change in a player's | |
* Elo rating after playing a single game against another player. | |
* The value K is the maximum change in rating. | |
**/ | |
function calculateELORatingChange(elo1, elo2, k) | |
{ | |
var percentage = 1 / ( 1 + Math.pow( 10, (elo2 - elo1) / 400 ) ); | |
return { |
/** | |
* Run with: $ node test-data.js | |
*/ | |
var mongoskin = require('mongoskin'), | |
http = require('http'), | |
db = mongoskin.db('mongodb://@localhost:27017/tuvok', {safe:true}), | |
coll = db.collection("posts"), | |
id, | |
titleDone = false, |
Add this to a bogart (or express etc.) route to do funky suff. See bogart-blog and just paste this in app.js
.
router.get('/✌☮✔', function (req) {
return 'Freedom and Peace = like!';
});
# Helper class to print colored output | |
# | |
# To use code like this, you can do something like | |
# | |
# print bcolors.WARNING | |
# + "Warning: No active frommets remain. Continue?" | |
# + bcolors.ENDC | |
# | |
# you can also use the convenience method bcolors.colored like this | |
# |
//See: http://stackoverflow.com/questions/15937267/inject-service-in-app-config | |
//See: http://stackoverflow.com/questions/14688290/inject-dependencies-in-run-method-of-the-module-in-angularjs | |
var app = angular.module('SystemSettings', ['ui.router', 'formly', 'formlyBootstrap']); | |
/** | |
* Set up routing | |
*/ | |
app.config(function($stateProvider, $urlRouterProvider) { | |
// For any unmatched url, redirect to /main |
#Meteor and Self-hosted Infrastructure
Meteor is an eye-opening JavaScript framework that runs on both the client and the server, giving developers a revolutionary take on software engineering. If you are not familiar with Meteor, I urge you to visit their website.
##An overview
In this brief gist, I am going to discuss the process of setting up a server (in my case, a VPS) to host Meteor applications.
My experience with Meteor has been brief, however it has not taken much demonstration for me to realise the significance of this stellar framework. Let's jump right in!
// Place your settings in this file to overwrite the default settings | |
{ | |
"window.zoomLevel": 0, | |
"editor.tabSize": 2, | |
"editor.detectIndentation": false, | |
"editor.formatOnSave": true, | |
"editor.minimap.enabled": true, | |
"editor.minimap.renderCharacters": false, | |
"editor.cursorStyle": "underline-thin", | |
"editor.dragAndDrop": true, |
iex(1)> lala = fn(msg) -> send self(), {:hello, msg} end | |
#Function<6.99386804/1 in :erl_eval.expr/5> | |
iex(2)> lala.("hehe") | |
{:hello, "hehe"} | |
iex(3)> lala.("hoho") | |
{:hello, "hoho"} | |
iex(4)> getst = fn() -> receive do {:hello, msg} -> "Got this #{inspect msg}" after 1_000 -> "Nothing after 1s" end end | |
#Function<20.99386804/0 in :erl_eval.expr/5> | |
iex(5)> getst.() | |
"Got this \"hehe\"" |