Skip to content

Instantly share code, notes, and snippets.

View dar5hak's full-sized avatar

Darshak Parikh dar5hak

View GitHub Profile
@myguidingstar
myguidingstar / core.cljs
Created July 10, 2019 01:19 — forked from yogthos/core.cljs
Gjs ClojureScript example
(ns gjs-example.core)
(defn main []
(set! (-> js/imports .-gi .-versions .-Gtk) "3.0")
(let [Gtk (doto (-> js/imports .-gi .-Gtk) (.init nil))
window (Gtk.Window.
(clj->js
{:type (-> Gtk .-WindowType .-TOPLEVEL)
:title "A default title"
:default_width 300
@yogthos
yogthos / core.cljs
Last active March 13, 2023 19:19
Gjs ClojureScript example
(ns gjs-example.core)
(defn main []
(set! (-> js/imports .-gi .-versions .-Gtk) "3.0")
(let [Gtk (doto (-> js/imports .-gi .-Gtk) (.init nil))
window (Gtk.Window.
(clj->js
{:type (-> Gtk .-WindowType .-TOPLEVEL)
:title "A default title"
:default_width 300
@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 ++++++++

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@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())
@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
@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::';
@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

@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!");