These rules are adopted from the AngularJS commit conventions.
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 http = require('http'); | |
var express = require('express'); | |
var router = express.Router(); | |
/* GET users listing. */ | |
router.get('/', function(req, res) { | |
var request = require('request'); | |
var url = req.query.url; |
#Exploring Entity Component Systems in Elm
Entity-Component-System (or ECS) is a pattern for designing programs that is prevalent in the games industry. This pattern consists of three simple parts:
- Entity : A uniquely identifiable object that may contain any number of components
- Component : A property usually representing the raw data of one aspect of the object. (Position is a component, Velocity is a component, Strength is a component, etc...)
- System : A continuous process performing actions on every entity that possesses a component of the same aspect as that system
To understand this, let us try to make a simple example: Boxes that move in space:
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
import List (map, (::)) | |
import Color (Color, rgb) | |
import Keyboard (arrows) | |
import Signal (Signal, (<~), foldp) | |
import Graphics.Collage (square, circle, move, filled, collage, Form) | |
import Graphics.Element (Element) | |
type alias Vector = { | |
x : Float, | |
y : Float |
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
import Color (Color, rgb) | |
import Graphics.Collage (..) | |
import Graphics.Element (Element) | |
import List ((::), map) | |
import Signal (Signal, foldp, (<~), sampleOn) | |
import Keyboard (arrows) | |
import Time (millisecond, every) | |
-------------------------- |
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
// This works on all devices/browsers, and uses IndexedDBShim as a final fallback | |
var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB; | |
// Open (or create) the database | |
var open = indexedDB.open("MyDatabase", 1); | |
// Create the schema | |
open.onupgradeneeded = function() { | |
var db = open.result; | |
var store = db.createObjectStore("MyObjectStore", {keyPath: "id"}); |
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
(*--------------------------------------------------------------------------- | |
Copyright (c) 2015 Daniel C. Bünzli. All rights reserved. | |
Distributed under the BSD3 license, see license at the end of the file. | |
%%NAME%% release %%VERSION%% | |
---------------------------------------------------------------------------*) | |
(* Simple generators according to: | |
Kiselyov, Peyton-Jones, Sabry | |
Lazy v. Yield: Incremental, Linear Pretty-printing |
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
import _ from 'lodash'; | |
import angular from 'angular'; | |
import 'angular-new-router'; | |
import 'oclazyload'; | |
function AppController ( ) { | |
} | |
AppController.$routeConfig = []; |
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
// imports a couple of java tasks | |
apply plugin: "java" | |
// List available tasks in the shell | |
> gradle tasks | |
// A Closure that configures the sourceSets Task | |
// Sets the main folder as Source folder (where the compiler is looking up the .java files) | |
sourceSets { | |
main.java.srcDir "src/main" |