Skip to content

Instantly share code, notes, and snippets.

Avatar

Gajus Kuizinas gajus

View GitHub Profile
View README.md

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

View after-1-second.sql
Limit (cost=0.44..1207.85 rows=100 width=20) (actual time=4773.131..4776.546 rows=100 loops=1)
Output: id, start_time, last_event_seating_asked_at
Buffers: shared hit=293806 read=2825
-> Index Only Scan using current_event_last_event_seating_asked_at_start_time_venue_id_i on public.current_event ce1 (cost=0.44..1207385.77 rows=99998 width=20) (actual time=4773.130..4776.531 rows=100 loops=1)
Output: id, start_time, last_event_seating_asked_at
Index Cond: ((ce1.last_event_seating_asked_at < (now() - '03:00:00'::interval)) AND (ce1.start_time >= now()) AND (ce1.start_time <= (now() + '7 days'::interval)))
Filter: (ce1.venue_id <> ALL ('{52531,52532,52551,52552,52554,52595,52596,52597,52598,52599,52600,52601,52602,52603,52604,52605,52606,52607,52608,52609,52610,52611,52612,52613,52614,52615,52616,52617,52618,52619,52620,52621,52622,52623,52624,52626,52627,52628,52629,52630,52631,52632,52633,52634,52635,52636,52637,52638,52639,52640,52641,52642,52643,52644,52645,52646,52647,52648,
View query.sql
EXPLAIN ANALYZE
SELECT
hrp1.id
FROM http_request_plan hrp1
LEFT JOIN LATERAL (
SELECT
count(*) request_count,
CASE
WHEN count(*) = 0
THEN NULL
View gist:4d6da2135c0563cb7593352903b5d9d0
(node:73239) UnhandledPromiseRejectionWarning: Error: Client was closed and is not queryable
at process.nextTick (/Users/gajus/Documents/dev/gajus/slonik/node_modules/pg/lib/client.js:471:25)
at process.internalTickCallback (internal/process/next_tick.js:70:11)
(node:73239) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:73239) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
error TypeError: cancellableConnectionRoutine(...).resolve is not a function
at resolve (/Users/gajus/Documents/dev/gajus/slonik/src/.sandbox/test.js:33:12)
at new Promise (<anonymous>)
at pool.connect (/Users/gajus/Documents/dev/gajus/slonik/src/.sandbox/test.js:19:14)
at process.in
View gist:5487925
function distanceGeoPoints ($long1, $lat1, $long2, $lat2) {
$lat = deg2rad($lat2 - $lat1);
$long = deg2rad($long2 - $long1);
$a = sin($lat/2) * sin($lat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($long/2) * sin($long/2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$d = 6371 * $c;
return $d;
}
View gist:6ffa6e0bed23447076de
$GLOBALS['translation'] = [
'authentication_error' => 'You must authorise Facebook application!',
'geofence_restricted' => 'Sorry, this game is currently not available in your country.',
'terms_and_conditions' => 'Terms & Conditions',
'terms_and_conditions_url' => 'http://www.sky.com/tv/show/the-blacklist/article/facebook-game',
'privacy_policy' => 'Privacy Policy',
'privacy_policy_url' => 'http://help.sky.com/security/privacy/privacy-and-cookies-notice',
View lookup_alternative_ids_by_imdb_id.sparql
SELECT
?ROTEN_TOMATOES_ID
?METACRITIC_ID
WHERE
{
?item wdt:P345 "${movieRecord.imdbId}" .
OPTIONAL {
?item wdt:P1258 ?ROTEN_TOMATOES_ID .
?item wdt:P1712 ?METACRITIC_ID .
}
View wm.js
let doFoo = new WeakMap(),
doBar = new WeakMap();
class Foo {
constructor () {
doFoo.set(this, () => {
// definition of doFoo for the instance of Foo.
});
doBar.set(this, () => {