Skip to content

Instantly share code, notes, and snippets.

View iissnan's full-sized avatar
💭
I may be slow to respond.

Vi iissnan

💭
I may be slow to respond.
View GitHub Profile
@iissnan
iissnan / snake.js
Created January 6, 2014 06:05
Snake Game
// MAP INFO
MAP_WIDTH = 300;
MAP_HEIGHT = 300;
MAP_BORDER = 0;
PORTRAIT_DIMENSION = 30;
LANDSCAPE_DIMENSION = 30;
CELL_WIDTH = MAP_WIDTH / PORTRAIT_DIMENSION;
CELL_HEIGTH = MAP_HEIGHT / LANDSCAPE_DIMENSION;
// CANVAS_INFO
angular.module("testModule", [])
// syntax: module.directive("namespaceName", factory)
// factory will be invoked once by $compiler to create a directive for the first time match happens
// and invoked via $inject.invoke makes it injectable just like a controller.
.directive("testDirective", function directiveFactory($log) {
var directiveDefinitionObject = {};
return directiveDefinitionObject;
// or return a constructor function
@iissnan
iissnan / connection_windows_ubuntu.md
Last active December 31, 2015 11:39
Connect from Windows(Host) to Ubuntu(VMWare Machine) via SSH.

Install openssh-server in ubuntu:

sudo apt-get install openssh-server

then, connect with putty via SSH in windows.

A commit is REQUIRED to notify GitHub to create gh-pages for the forked repository.

// 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!"
Function Defines
provider(name, Object OR constructor()) A configurable service with complex creation logic. If you pass an Object, it should have a function named $get that returns an instance of the service. Otherwise, Angular assumes you’ve passed a constructor that, when called, creates the instance.
factory(name, $get Function()) A non-configurable service with complex creation logic. You specify a function that, when called, returns the service instance. You could think of this as provider(name, { $get: $getFunction() } ).
service(name, constructor()) A non-configurable service with simple creation logic. Like the constructor option with provider, Angular calls it to create the service instance.
| Left align | Right align | Center align |
|:-----------|------------:|:------------:|
| This       |        This |     This     
| column     |      column |    column    
| will       |        will |     will     
| be         |          be |      be      
| left       |       right |    center    
| aligned    |     aligned |   aligned
@iissnan
iissnan / update_submodule.md
Last active December 30, 2015 21:29
Update git submodule.

You can use git submodule foreach to handle a batch of submodules:

git submodule foreach git pull origin master

Or, update submodule one by one:

# go to submodule directory and update to latest.
@iissnan
iissnan / sgs.css
Created December 8, 2013 15:32
Stylebot Global StyleSheet
@import url("http://fonts.googleapis.com/css?family=Roboto+Slab");
/*@import url("http://fonts.googleapis.com/css?family=Droid+Serif");*/
@import url("http://fonts.googleapis.com/css?family=Droid+Sans:400,700");
@import url("http://fonts.googleapis.com/css?family=Droid+Sans+Mono");
body, p, td {
font-family: "Droid Sans", Calibri, "Lucida Grande", sans-serif;
{
"cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"variants":
[
{
"name": "Run",