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
const now = new Date(); | |
const utcNow = new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()); | |
// A js Date object stores 2 primitive values: x and tz, based on y. For instance: new Date(y); IF y = NULL, y = machine time. | |
// - y = machine time (x + tz) | |
// - tz = machine tz. i.e: +8 | |
// - console.log(now.toString()) returns (x + tz); |
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 config | |
configfile=config.env | |
ifdef cnf | |
configfile=$(cnf) | |
endif | |
include $(configfile) | |
export $(shell sed 's/=.*//' $(configfile)) | |
# import deploy config | |
deployfile=deploy.env |
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
as := dynamo.New(sess, &aws.Config{Region: aws.String("ap-southeast-1")}) | |
t := as.Table("Dev_Beam") | |
type SpMeta struct { | |
Distance float64 `dynamo:"distance"` | |
} | |
type beam struct { | |
TaskID int `dynamo:"task_id"` // Hash key, a.k.a. partition key | |
SpIDTimestamp string `dynamo:"sp_timestamp"` // Range key, a.k.a. sort key |
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
http://stackoverflow.com/questions/34423746/gocode-external-package-give-no-suggestion-for-vscode |
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
INSERT INTO `gb_m_incentive_program` (`name`, `allow_multiple_per_cycle`, `priority`, `amount`, `criteria`, `created_at`, `updated_at`, `is_deleted`, `is_active`, `currency`, `iteration`, `cycle`, `duration`, `execution_count`, `current_iteration`, `current_cycle`, `starts_at`, `expires_at`, `next_run`, `prev_run`, `is_running`, `timezone`, `bonus`, `duration_unit`) | |
VALUES | |
(9, 'Incentive Milestone (Round 2)', 0, 1, 0.00, '{\"conditions\":[{\"table\":\"gb_m_task AS t\",\"columns\":[\"t.sp_id\"],\"count\":\"t.task_id AS score\",\"joinRaw\":[{\"value\":\"INNER JOIN gb_m_sp s ON s.sp_id = t.sp_id\"}],\"where\":[{\"column\":\"stage\",\"op\":\"=\",\"value\":\"6\"},{\"column\":\"overall_status\",\"op\":\"=\",\"value\":\"100\"},{\"column\":\"t.sp_id\",\"op\":\"is not\",\"value\":null},{\"column\":\"t.created_at\",\"op\":\">=\",\"var\":\"scandate_lower_bound\"},{\"column\":\"s.sp_type\",\"op\":\"=\",\"value\":0},{\"column\":\"t.created_at\",\"op\":\"<\",\"var\":\"scandate_upper_bound\"}],\"groupBy\":\"t.sp_id\",\"hav |
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
# Query/use custom command for `git`. | |
zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd | |
: ${_omz_git_git_cmd:=git} | |
# | |
# Functions | |
# | |
# The name of the current branch | |
# Back-compatibility wrapper for when this function was defined herea in |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
cd ~/Homestead | |
vagrant up |
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
SELECT * | |
FROM gb_m_promo p | |
LEFT JOIN gb_n_promo_period t ON p.promo_code = t.promo_code | |
WHERE TRUE | |
AND CASE WHEN is_time_based = 1 THEN CURTIME() BETWEEN from_time AND to_time ELSE TRUE END; | |
# time diff |
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
ALTER TABLE `gb_n_incentive` ADD CONSTRAINT `sp_id` UNIQUE `sp_id` (`sp_id`,`incentive_program_id`,`term_weeks`); | |
ALTER TABLE `gb_n_incentive` DROP INDEX `sp_id`; |