Skip to content

Instantly share code, notes, and snippets.

View jeremyben's full-sized avatar
🐔
NaN hopefully.

Jeremy Bensimon jeremyben

🐔
NaN hopefully.
  • France
View GitHub Profile
@fracz
fracz / memoize-expirable-decorator.spec.ts
Created January 14, 2017 11:54
Typescript memoize decorator with expiration time
import {memoize, clearMemoizedValue} from "./memoize";
describe("memoize", () => {
class MyClass {
@memoize(5)
getNumber() {
return Math.random();
}
}
@nomand
nomand / AppleWKRemapper.ahk
Last active December 2, 2021 02:05 — forked from TheZoc/AppleWKRemapper.ahk
AutoHotKey script that allows Apple wireless keyboard work in Windows 10 with some layout changes. See header for details and credits to original authors and modders.
;===========================================================================================================================================
; Additional Modifications by nomand
;==========================================================================================================================================
;
; - fixed Media_Next functinality
; - moved Eject key screenshots to active window screenshot shortcut (Ctrl+F3)
; - restored Lctrl <> Fn swap
; - restored page up/down, home/end functinality
; - F12 Insert remap kept disabled
; - cleaned up code indentations and comments
@laser
laser / 0a.hs
Last active April 13, 2023 14:06
An Introduction to ADTs and Structural Pattern Matching in TypeScript
data Failable t e = Success t | Failure e
@hfossli
hfossli / standard.sh
Last active February 8, 2024 05:19
Standard bash script format
#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"
@vijeetgv
vijeetgv / The Technical Interview Cheat Sheet.md
Last active November 24, 2018 20:04 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

Array

Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@slyphon
slyphon / AsyncExpress.ts
Last active May 7, 2019 11:44
a Typescript implementation of Awaitjs-Express (@awaitjs/express): async wrappers for express router methods
// Copyright 2018 Jonathan Simms
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
@iPublicis
iPublicis / myapp-node-watcher.path
Last active March 26, 2024 21:06
NODE.JS app as a systemd service with CI controller
#########
# File: myapp-node-watcher.path
#
# Save this to /etc/systemd/system/
# Run systemctl enable myapp-node-watcher.path && systemctl daemon-reload && systemctl start myapp-node-watcher.path
#
[Path]
PathModified=/home/myuser/myappdir/public_html
[Install]
@dmorosinotto
dmorosinotto / TestTypedForms.ts
Last active July 7, 2023 05:09
Typed @angular/forms FIXED set/patchValue - strict all the way down ^_^
import { FormGroup, FormControl, FormArray, Validators } from "@angular/forms";
function testFormGroupTyped() {
var frm = new FormGroup({
a: new FormArray([new FormControl(0)]),
b: new FormControl(true),
c: new FormGroup({
s: new FormControl("abc"),
n: new FormControl(123)
})
@cvle
cvle / expectAndFail.js
Last active May 31, 2019 17:44
Workaround for Jest Assertions not failing tests in a try/catch block
// Jest assertions will not fail if they live inside a try-catch block due to
// https://github.com/facebook/jest/issues/3917.
// This file returns a version of `expect` that fails
// the test immediately when an exception is thrown.
/**
* isPromise detects whether given object is a promise or not.
*/
const isPromise = obj =>
@carlolars
carlolars / .wsl-git.md
Last active February 4, 2024 07:21
HOWTO: Use WSL and its Git in a mixed development environment

How to setup a development environment where Git from WSL integrates with native Windows applications, using the Windows home folder as the WSL home and using Git from WSL for all tools.

Note if using Git for Windows, or any tool on the Windows side that does not use Git from WSL then there will likely be problems with file permissions if using those files from inside WSL.

Tools

These are the tools I use:

  • git (wsl) - Command line git from within WSL.
  • Fork (windows) - Git GUI (must be used with wslgit)
  • wslgit - Makes git from WSL available for Windows applications. Important! Follow the installation instructions and do (at least) the first optional step and then the Usage in Fork instructions.