start new:
tmux
start new with session name:
tmux new -s myname
ActiveRecord::Base.connection.tables.map do |model| | |
model.capitalize.singularize.camelize | |
end | |
# returns ["Activity", "Article", "User", "Video", "Vote"] |
0-mail.com | |
0815.ru | |
0clickemail.com | |
0wnd.net | |
0wnd.org | |
10minutemail.com | |
20minutemail.com | |
2prong.com | |
30minutemail.com | |
3d-painting.com |
https://github.com/djvirgen/virgen-acl Simple and elegant, create your own checks. No middleware?
https://github.com/OptimalBits/node_acl Use as middleware, create your own roles and access. Great choice.
https://github.com/tschaub/authorized Similar to connect roles... but a bit more robust? you can create roles and action, and associate many roles with that action
if (moment().quarter() == 4) { | |
var current_fiscal_year_start = moment().month('October').startOf('month'); | |
var current_fiscal_year_end = moment().add('year', 1).month('September').endOf('month'); | |
var last_fiscal_year_start = moment().subtract('year', 1).month('October').startOf('month'); | |
var last_fiscal_year_end = moment().month('September').endOf('month'); | |
} else { | |
var current_fiscal_year_start = moment().subtract('year', 1).month('October').startOf('month'); | |
var current_fiscal_year_end = moment().month('September').endOf('month'); | |
var last_fiscal_year_start = moment().subtract('year', 2).month('October').startOf('month'); | |
var last_fiscal_year_end = moment().subtract('year', 1).month('September').endOf('month'); |
Magic words:
psql -U postgres
Some interesting flags (to see all, use -h
or --help
depending on your psql version):
-E
: will describe the underlaying queries of the \
commands (cool for learning!)-l
: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)// controllers/LoginController.js | |
module.exports = { | |
index: function(req, res) { | |
var email = req.param('email'); | |
var password = req.param('password'); | |
// delay everthing to prevent bruteforce, dos and timing attacks | |
setTimeout(function() { |
/* VT100 terminal reset (<ESC>c) */ | |
console.log('\033c'); | |
/* numbers comparations */ | |
> '2' == 2 | |
true | |
> '2' === 2 |
Simple implementation of debounced fetching in GraphQL to allow merging of multiple rest / database requests into one. Although this example uses GraphQL, the debouncedFetch
/ fetchProgramPlaycount
implementations could probably be used in any context to achieve the same result.
This approach was first described by @leebyron at graphql/graphql-js#19 (comment)
For example this allows turning ten requests for playcounts from this GraphQL query into just one:
{
latestPrograms(first: 10) {
name,
playcount