class MyClass
include Enums
enum foo: [:x, :y]
end
const DECK uint64 = 1 << 52 - 1 | |
func isValidSet(x uint64) (bool) { | |
return x <= DECK | |
} |
.pc { content: "\1F0A0"; font-size: 5em; line-height: 100%;} | |
.pc.suit-hearts, | |
.pc.suit-diamonds { color: indianred; } | |
.pc.suit-hearts.face-2:after { content: "\1F0A2" } | |
.pc.suit-hearts.face-3:after { content: "\1F0A3" } | |
.pc.suit-hearts.face-4:after { content: "\1F0A4" } | |
.pc.suit-hearts.face-5:after { content: "\1F0A5" } | |
.pc.suit-hearts.face-6:after { content: "\1F0A6" } | |
.pc.suit-hearts.face-7:after { content: "\1F0A7" } |
alias c='bundle exec rails c' | |
alias hc='heroku run bundle exec rails c' | |
alias hl='heroku login --sso' |
toSnakeCase = s => s.replace(/(?:^|\.?)([A-Z])/g, (x,y) => "_" + y.toLowerCase()).replace(/^_/, "") | |
editor = atom.workspace.getActiveTextEditor(); | |
path = editor.getPath(); | |
fileName = editor.getFileName(); | |
fileExt = fileName.split('.').pop(); | |
dir = path.substring(0, path.length - fileName.length); | |
selectedText = editor.getSelectedText(); | |
newPath = dir + toSnakeCase(selectedText) + '.' + fileExt; |
/** | |
* @param {string} s | |
* @return {number} | |
*/ | |
var romanToInt = function(s) { | |
var map = { | |
'I': 1, | |
'V': 5, | |
'X': 10, | |
'L': 50, |
/** | |
* Definition for a binary tree node. | |
* function TreeNode(val) { | |
* this.val = val; | |
* this.left = this.right = null; | |
* } | |
*/ | |
/** | |
* @param {TreeNode} root | |
* @return {number[]} |
In Redux, you should not use Store as cache, but rather for things that need to be truly retained, across the application.
For example, when you have a screen to display holidays, and another screen to display details of a holiday:
there is a tendency to keep the list of holidays in the central store, so that when we go "back" from details screen, our list is available immediately (without need to wait for an api call).
Web have a node application written in ES6/babel which cannot (yet) be run by the latest stable node engine.
Locally we use babel-node
to run the application using babel's on-the-fly transpiler;
However this is strongly discourages on the production environment (due to memory and performance footprints).
So we would need to transpile our application to the stable ECMA and deploy the artefacts to Azure -- instead of the original app.
function solution(input) { | |
if (input.length === 0) { | |
return []; | |
} | |
// sort by first element of each interval | |
// O(n log n) | |
intervals = input.slice(0); | |
intervals.sort(([a], [b]) => a - b); |