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
pg.query( | |
"INSERT INTO testtable (id, name) SELECT * FROM UNNEST ($1::int[], $2::text[])", | |
[ | |
[1, 2, 3], | |
["Jack", "John", "Jill"], | |
] | |
) | |
Source: https://github.com/brianc/node-postgres/issues/957#issuecomment-295583050 |
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 date = new Date(); | |
var jan = new Date(date.getFullYear(), 0, 1); | |
var jul = new Date(date.getFullYear(), 6, 1); | |
// Offset is in minutes | |
var stdTimezoneOffset = Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset()); | |
// Convert to local machine timezone for date object in PST | |
var timezoneDiffFromPST = stdTimezoneOffset - 480; | |
date += timezoneDiffFromPST * 60 * 60 * 1000; |
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> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Promise example</title> | |
<link rel="stylesheet" href=""> |
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
Sort by key | |
Numbers/Dates | |
new Map([...map].sort((a, b) => a[0] - b[0])) | |
Strings | |
new Map([...map].sort((a, b) => +(a[0] > b[0]) || +(a[0] === b[0]) - 1)) | |
Sort by an object property value |
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
<template> | |
<div> | |
<md-input md-label="put some text here" md-value.bind="textValue" md-disabled.bind="disabledValue"></md-input><br /> | |
You entered: ${textValue}<br /> | |
<button md-button="flat: true;" md-waves class="accent-text" click.delegate="setText()">set text to something</button> | |
<button md-button="flat: true;" md-waves class="accent-text" click.delegate="setDisabled()">Toggle Input Disabling</button> | |
<md-input view-model.ref="inputElement" md-label="readonly - bound to the field above" md-value.bind="textValue" md-readonly.bind="true"></md-input><br /> | |
</div> | |
<div> |
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
<template> | |
<require from="./radio-select"></require> | |
<style> | |
form > label { | |
display: block; | |
margin-top: 10px; | |
} | |
</style> | |
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
<template> | |
<h1>${message}</h1> | |
</template> |
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 ref="mySelect" filtered.bind="sites | filter: { project: project }"> | |
<option if.bind"mySelect.filtered.length === 0">No Sites Available</option> | |
<option repeat.for="site of mySelect.filtered">${site.name}</option> | |
</select> |
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
jSigHelper = (function() { | |
var chunkSeparator = '_' | |
, charmap = {} // {'1':'g','2':'h','3':'i','4':'j','5':'k','6':'l','7':'m','8':'n','9':'o','a':'p','b':'q','c':'r','d':'s','e':'t','f':'u','0':'v'} | |
, charmap_reverse = {} // will be filled by 'uncompress*" function | |
// need to split below for IE7 (possibly others), which does not understand string[position] it seems (returns undefined) | |
, allchars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWX'.split('') | |
, bitness = allchars.length / 2 | |
, minus = 'Z' | |
, plus = 'Y' | |