Skip to content

Instantly share code, notes, and snippets.

View peernohell's full-sized avatar
😁

Francois peernohell

😁
View GitHub Profile
@creedda
creedda / light-state-sync.yaml
Last active April 13, 2024 09:33 — forked from fireboy1919/light-state-sync.yaml
Synchronize States Between Two Lights
blueprint:
name: Synchronize brightness states and rgb states
description: Synchronize the on/off state of 2 entities
domain: automation
input:
entity_1:
name: First entity
selector:
entity: {}
entity_2:
@banjerluke
banjerluke / GroundedCollection.ts
Created December 1, 2021 14:41
GroundedCollection (rewrite of ground:db for Meteor 2.4+)
import Dexie from 'dexie';
import { EJSON } from 'meteor/ejson';
import type { Mongo } from 'meteor/mongo';
import type { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { throttle } from 'underscore';
import { PendingCounter } from './PendingCounter';
interface LocalCollectionInternal {
queries: Record<any, any>;
@nybblr
nybblr / 1-easy.js
Last active July 13, 2022 03:40
3 examples of using Async Generators and Async Iteration in JavaScript!
// Create a Promise that resolves after ms time
var timer = function(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
// Repeatedly generate a number starting
// from 0 after a random amount of time
var source = async function*() {
@charlenopires
charlenopires / Material-Design---Sidebar-(Profile-menu).markdown
Created November 29, 2014 02:28
Material Design - Sidebar (Profile menu)
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@toolmantim
toolmantim / Makefile
Last active December 5, 2022 23:14
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
@sixFingers
sixFingers / gist:5881446
Last active December 19, 2015 02:09
Proof of concept for end-to-end testing in Meteor, with Phantom JS and... Meteor itself.

Prerequisites

Install phantomJS:

[sudo] npm install -g phantom

Create a /tests folder into your Meteor app:

cd [app folder] && mkdir tests && cd tests

@willurd
willurd / web-servers.md
Last active May 6, 2024 13:43
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 6, 2024 12:37
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@bnoordhuis
bnoordhuis / trace-all-events.js
Created January 3, 2012 14:38
Trace all events in a node.js application
(function() {
var EventEmitter = require('events').EventEmitter;
var inspect = require('util').inspect;
var emit_ = EventEmitter.prototype.emit;
EventEmitter.prototype.emit = function(name) {
var args = Array.prototype.slice.call(arguments);
if (!(this === process.stderr && name === 'drain')) {
console.error("Event '%s', arguments: %s",
name, inspect(args.slice(1), false, 1));
}