Skip to content

Instantly share code, notes, and snippets.

View dar5hak's full-sized avatar

Darshak Parikh dar5hak

View GitHub Profile
@staltz
staltz / introrx.md
Last active July 4, 2024 10:11
The introduction to Reactive Programming you've been missing
@john2x
john2x / 00_destructuring.md
Last active June 6, 2024 13:40
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@nolanlawson
nolanlawson / protips.js
Last active February 4, 2024 18:06
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@nzakas
nzakas / alias.md
Created September 11, 2015 17:59
Some simple scripts I use to manage open source branches

Usage:

To create a new branch that is up-to-date with the remote master:

$ ws 123

Creates the branch issue123

@adactio
adactio / basicServiceWorker.js
Last active March 27, 2023 09:30
A basic Service Worker, for use on, say, a blog.
'use strict';
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
(function() {
// Update 'version' if you need to refresh the cache
var staticCacheName = 'static';
var version = 'v1::';
@DmitrySoshnikov
DmitrySoshnikov / expression-only.md
Last active April 16, 2016 12:00
ES: Expression only

"Everything is an expression"... since ES1?

Many languages support "expression-only" semantics, allowing to use any construct in an expression position.

NOTE: the difference between expressions and statements is that the former produce a value, while the later don't.

For example, Ruby's if-expression:

x = 10
@winkerVSbecks
winkerVSbecks / poll.js
Created October 2, 2016 17:45
angular 2 observable polling
Rx.Observable
.interval(500)
.flatMap(() => [1, 2, 3] /* in angular you will call getData() to make an HTTP request */)
.map(x => x + 1)
.subscribe(x => console.log(x))
function getData() {
return this.http
.get('https://api.spotify.com/v1/search?q=' + term + '&type=artist')
.map((response) => response.json())

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@peterychuang
peterychuang / 0001-udev-Add-Apple-SPI-Keyboard-and-Touchpad.patch
Created August 4, 2017 06:00
Enable touch-size-based palm rejection and disable touchpad while typing for Apple SPI Keyboard and Touchpad under libinput
From a3febd1a49f259049d0d9650e297590b56d71ae4 Mon Sep 17 00:00:00 2001
From: "Peter Y. Chuang" <peteryuchuang@gmail.com>
Date: Fri, 4 Aug 2017 00:24:36 +0200
Subject: [PATCH libinput] udev: Add Apple SPI Keyboard and Touchpad
This enables touch-size-based palm rejection and disable-while-typing
touchpad feature for the SPI keyboards and touchpads inside the 12-inch
MacBooks and 2016 or later MacBook Pros.
---
udev/90-libinput-model-quirks.hwdb | 8 ++++++++