Skip to content

Instantly share code, notes, and snippets.

View greenlikeorange's full-sized avatar
🎯
Focusing

nonce greenlikeorange

🎯
Focusing
  • Base Technology
  • Yangon, Myanmar
View GitHub Profile
@greenlikeorange
greenlikeorange / template.js
Last active August 29, 2015 14:03
Template Controller
// Template Controller jQuery plug-in
//
// Contribute : greenlikeorange <beginofalove@hotmail.com>
// License : MIT
(function(jQuery){
// Template Selector RegExp ${data}
var reTmp = /\${([\w\.]+)}/;
<!DOCTYPE html>
<html ng-app="ngApp">
<head>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/css/normalize.min.css" rel="stylesheet" type="text/css" />
<link href="//cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/css/foundation.min.css" rel="stylesheet" type="text/css" />
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/foundation/5.0.3/js/foundation.min.js"></script>
<meta charset="utf-8">
@greenlikeorange
greenlikeorange / index.html
Last active August 29, 2015 14:05
Myanmar Blacklist words
<!DOCTYPE html>
<html lang='my'>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style id="jsbin-css">
body {
font-family: Padauk;
}
@greenlikeorange
greenlikeorange / filterExample.js
Created August 26, 2014 18:35
Filter with Mongoose Schema
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// Create Simple Post Schema
var Post = new Schema({
owner: { type: Schema.Types.ObjectId, ref: 'User' },
createdAt: { type: Date, default: new Date(), required: true },
message: { type: String }
});
@greenlikeorange
greenlikeorange / filestream.js
Created September 16, 2014 04:53
Stream request
var http = require('http');
http.createServer(function(req, res) {
var proxy = http.createClient(80, 'http://server2.com')
var proxyRequest = proxy.request(request.method, request.url, request.headers);
proxyRequest.on('response', function (proxyResponse) {
proxyResponse.pipe(response);
});
request.pipe(proxyRequest);
}).listen(3000);
@greenlikeorange
greenlikeorange / jadejadejade
Created October 13, 2014 15:38
Jade Jade Jade
a(href='/mylink', target='blank')
button(onclick='alert("New tab is openning")') Click Me
@greenlikeorange
greenlikeorange / to64cons.js
Last active August 29, 2015 14:07
Number To Base64 Consonants
var b64c = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + /".split(" ");
function cc(number, consonants){
var len = consonants.length,
_res = "",
_que;
while(number>=0){
_que = number%len;
_res = consonants[_que] + _res;
@greenlikeorange
greenlikeorange / index.js
Created October 16, 2014 05:43
Short and Secure MongoDB ObjectID
var asciiStr = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 + /".split(" ");
var my64shortStr = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 - _".split(" ");
var ascii2my64 = {};
var my64toascii = {};
for(var i = 0; i < asciiStr.length; i++){
ascii2my64[asciiStr[i]] = my64shortStr[i];
my64toascii[my64shortStr[i]] = asciiStr[i];
}
@greenlikeorange
greenlikeorange / fonttaggle.js
Last active August 29, 2015 14:09
ကိန္ဒရီ ဖောင့်တွဲခွဲ စနစ်
/**
* Knayi-myscript Detection and font tagging script
*
* Nov 10, 2014
* greenlikeorange<beginofalove@hotmail.com>
*
* original:
* https://github.com/greenlikeorange/knayi-myscript
*
*/
@greenlikeorange
greenlikeorange / const_function
Last active August 29, 2015 14:10
CONST Example under ES6
function CONST (obj, key, value){
Object.defineProperty(obj, key, {
enumerable: false,
configurable: false,
writable: false,
value: value
});
}