Skip to content

Instantly share code, notes, and snippets.

(function($){
var I18N = function(){};
I18N.prototype.lng = function lng() {
return $('html').attr('lang').toUpperCase() || 'EN-US';
};
I18N.prototype.t = I18N.prototype.translate = function translate(key) {
if(!key) {
return this;
# Load balancer configuration
upstream exampleApp {
# Directs to the process with least number of connections.
least_conn;
# One failed response will take a server out of circulation for 20 seconds.
server 127.0.0.1:10080 fail_timeout=20s;
#server 127.0.0.1:10081 fail_timeout=20s;
#server 127.0.0.1:10082 fail_timeout=20s;
#server 127.0.0.1:10083 fail_timeout=20s;
@IskenHuang
IskenHuang / local.js
Created December 3, 2013 07:26
sails.js config/local.js default
/**
* Local environment settings
*
* While you're developing your app, this config file should include
* any settings specifically for your development computer (db passwords, etc.)
* When you're ready to deploy your app in production, you can use this file
* for configuration options on the server where it will be deployed.
*
*
* PLEASE NOTE:
@IskenHuang
IskenHuang / README.md
Last active December 26, 2015 20:39
grunt-contrib-connect middleware redirect function

GOAL

grunt-contrib-connect middleware redirect function. easy to use make fake api for front-end. This sample used yeoman generator gruntfile.

how to use

  • download redirect.js to project root.
  • edit Gruntfile.js
var redirect = require('./redirect');
@IskenHuang
IskenHuang / local.js
Created October 10, 2013 15:37
sails.js deploy to openshift setup
module.exports = {
host: process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1',
// port: process.env.PORT || 1337,
port: process.env.OPENSHIFT_NODEJS_PORT || 80,
// environment: process.env.NODE_ENV || 'development'
// environment: process.env.NODE_ENV || 'production'
environment: process.env.NODE_ENV || 'development'
@IskenHuang
IskenHuang / flash.html
Created September 30, 2013 06:27
include flash in html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled-1</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
html, body { height:100%; background-color: #ffffff;}
body { margin:0; padding:0; overflow:hidden; }
#flashContent { width:100%; height:100%; }
</style>

page

137 ~ 152

$location

The $location service is a wrapper around the window.location that is present in any browser.

global status

The minute you have global state in your application, testing, maintaining and working with it becomes a hassle.

/*timestamp and datacreate
don't forget to set validate columns to ONLY DATA_VALUES for datacreate and timstamp columns
Do not allow to enter not valid data!
I don't know how to do this inside the script.*/
function onEdit(e) {
//########################## SETUP BEGIN ###################################
var dc = 'datacreate'; //set datacreate_column_header
var ts = 'timestamp'; //set timestamp_column_header
// var dc_fontcolor = '#808080'; //set font-color in HEX or CSS mode for datacreate column
// var ts_fontcolor = '#808080'; //set font-color in HEX or CSS mode for timestamp column
@IskenHuang
IskenHuang / cssInsertToHtml.coffee
Created September 9, 2013 16:13
styles link insert to html head
fs = require('fs')
cheerio = require('cheerio')
staticFolder = 'static'
cssFolder = 'css'
cssRoot = __dirname + '/' + cssFolder
htmlFolder = 'views'
htmlRoot = __dirname + '/../application/' + htmlFolder
@IskenHuang
IskenHuang / imageToUri.coffee
Created September 9, 2013 15:08
image in css, html from url to uri
fs = require('fs')
cheerio = require('cheerio')
staticFolder = 'static'
imgFolder = 'img'
cssFolder = 'css'
cssRoot = __dirname + '/' + cssFolder
htmlFolder = 'views'
htmlRoot = __dirname + '/../application/' + htmlFolder