Skip to content

Instantly share code, notes, and snippets.

View expelledboy's full-sized avatar

Anthony Jackson expelledboy

View GitHub Profile
@jiraguha
jiraguha / deno-script.md
Last active December 21, 2023 14:19
Deno for scripting

Deno for scripting

Foreword

It is largely inspired by kscript. The idea is to leverage the scripting abilities of javascript using Deno. I feel that scripting can be so much fun with Deno as:

  • It can import modules from any location on the web,
  • It is secure by default. Imported module can run in sandbox.
  • It is Supports TypeScript out of the box.
  • It is much more that Node
import firebase from 'firebase';
import produce from 'immer';
import { useEffect, useReducer, useRef, useCallback } from 'react';
type IAction<K, V = void> = V extends void ? { type: K } : { type: K } & V;
export type IActionType =
| IAction<'LOAD_REQUEST'>
| IAction<
'LOAD_SUCCESS',
@sibelius
sibelius / NativeModules.js
Created December 3, 2019 20:49
react-native mock with SettingsManager
jest.mock('react-native/Libraries/BatchedBridge/NativeModules', () => ({
AlertManager: {
alertWithArgs: jest.fn(),
},
AsyncLocalStorage: {
multiGet: jest.fn((keys, callback) =>
process.nextTick(() => callback(null, [])),
),
multiSet: jest.fn((entries, callback) =>
process.nextTick(() => callback(null)),
@dyno
dyno / date.libsonnet
Created May 31, 2019 05:33
date library for jsonnet
// ported date utility function from http://howardhinnant.github.io/date_algorithms.html
// @param z Days since epoch
// @return Civic date tuple [y, m, d]
local civil_from_days(z) = (
local z1 = z + 719468;
local era = std.floor((if z1 >= 0 then z1 else z1 - 146096) / 146097);
local doe = (z1 - era * 146097); // [0, 146096]
local yoe = std.floor((doe - std.floor(doe / 1460) + std.floor(doe / 36524) - std.floor(doe / 146096)) / 365); // [0, 399]
local y = yoe + era * 400;
@cweilguny
cweilguny / docker-compose-gitlab.yml
Last active October 27, 2021 00:55
A docker-compose config in v3 format for nginx-proxy with separate containers for nginx, dockergen and letsencrypt-companion. Additional example on how to get GitLab docker container running with this nginx-proxy setup. You need to create the docker network before, just run 'docker network create nginx-proxy'. Docker will tell you so if you don'…
version: '3'
services:
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
nginx['listen_port'] = 80
@charlietran
charlietran / TerminalVim.scpt
Last active October 14, 2023 06:50
Open file in iTerm vim for MacOS Sierra
-- TerminalVim.app
-- This creates a shim Application that will enable you to open files from the Finder in vim using iTerm
-- To use this script:
-- 1. Open Automator and create a new Application
-- 2. Add the "Run Applescript" action
-- 3. Paste this script into the Run Applescript section
-- 4. Save the application as TerminalVim.app in your Applications folder
-- 5. In the Finder, right click on a file and select "Open With". In that window you can set TerminalVim as a default
@boesing
boesing / private.xml
Created August 6, 2016 12:11
[Karabiner] FN to CTRL-L
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>Apple_Internal_Keyboard_Vendor</vendorname>
<vendorid>0x05ac</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>Apple_Internal_Keyboard_Product</productname>
<productid>0x0273</productid>
@lavaxun
lavaxun / README.md
Last active February 18, 2018 00:22 — forked from vincent99/README.md
Rancher on docker-for-mac with xhyve

Install Docker for Mac (http://beta.docker.com)

Install docker-machine-driver-xhyve (https://github.com/zchee/docker-machine-driver-xhyve)

brew install docker-machine-driver-xhyve
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

Deploy the latest release

@LeCoupa
LeCoupa / nodejs-cheatsheet.js
Last active April 19, 2024 01:50
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html