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
package net.kristopherjohnson.util; | |
import java.text.DateFormat; | |
import java.text.SimpleDateFormat; | |
import java.util.Date; | |
import java.util.Locale; | |
import java.util.TimeZone; | |
/** | |
* Methods for dealing with timestamps |
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
Something | |
.findOne({ | |
where: { | |
id: somethingId | |
} | |
}) | |
.then(function(something) { | |
throw new Error('something not found'); | |
return doSomethingCool(); |
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
Something | |
.findOne({ | |
where: { | |
id: somethingId | |
} | |
}) | |
.then(function(something) { | |
if (!something) { | |
res.notFound('Something is not found.'); | |
return; |
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
moment = function() { | |
return (require('moment-timezone')).tz('America/New_York'); | |
}, | |
console.log(moment().format()); | |
console.log(moment().day()); | |
console.log(moment().endOf('day').format()); | |
console.log(moment().endOf('day').format()); |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" /> | |
<!-- when.js Promises implementation --> | |
<script src="https://raw.github.com/cujojs/when/master/when.js"></script> | |
<!-- Unit testing and mocking framework --> | |
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script> |
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
// To disable socket.io, disable the sockets hook (you'll have to disable the pubsub hook as well) | |
// This is a replacement for the default app.js file: | |
require('sails').lift({ | |
hooks: { | |
sockets: false, | |
pubsub: false | |
} |
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 moment = require('moment'); | |
var today = moment().startOf('day'); | |
console.log("today ", moment().startOf('day')); | |
console.log("tomorrow ", moment(today).add(1, 'days')); | |
var day = moment().unix() * 1000; | |
var dayInISO = moment().millisecond(moment().unix()); | |
console.log(dayInISO.format()); | |
console.log("Today in ISO ", moment().format()); | |
console.log("Today ", moment()); |
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
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl https://www.npmjs.org/install.sh | sh |
# we ignore all the files inside upload directory
/*
# then we only include the following files, the rest of the files will be ignored
!.gitignore
!.gitkeep