Skip to content

Instantly share code, notes, and snippets.

View UltiRequiem's full-sized avatar

Eliaz Bobadilla UltiRequiem

View GitHub Profile
@chemzqm
chemzqm / repl.js
Last active May 29, 2021 00:05
repl with coc.nvim
// Save the file to ~/.vim/coc-extensions
// Usage: xmap <silent> <TAB> <Plug>(coc-repl-sendtext)
const {commands, workspace} = require('coc.nvim')
exports.activate = context => {
let {nvim} = workspace
let terminal
context.subscriptions.push(commands.registerCommand('repl.openTerminal', async () => {
let filetype = await nvim.eval('&filetype')
let prog = ''
@kawarimidoll
kawarimidoll / README.md
Last active November 26, 2021 16:28
get DENO_DIR
@espeed
espeed / setup.sh
Created May 6, 2012 15:13
Create and deploy a Python/Flask "hello world" app on Heroku.
#!/bin/bash
# Create and deploy a Python/Flask "hello world" app on Heroku.
# by James Thornton, http://jamesthornton.com
# To run it, do:
# $ heroku login
# $ bash setup.sh helloworld
# $ cd helloworld
@alii
alii / is-instance.ts
Created January 19, 2022 14:00
Useful error checking for promise chaining
type Constructor<T> = new (...args: any[]) => T;
type Then<T, R> = (value: T) => R;
export function ifInstance<T, R>(instance: Constructor<T>, then: Then<T, R>) {
return (value: unknown) => {
if (value instanceof instance) {
return then(value);
}
throw value;
@kelsny
kelsny / README.md
Last active February 13, 2022 16:31
CodeWars RoboScript Kata Solutions

These are my solutions to the RoboScript series of katas on CodeWars.

This Kata Series is based on a fictional story about a computer scientist and engineer who owns a firm that sells a toy robot called MyRobot which can interpret its own (esoteric) programming language called RoboScript. Naturally, this Kata Series deals with the software side of things (I'm afraid Codewars cannot test your ability to build a physical robot!).

@Ricket
Ricket / brainfucc.c
Created April 24, 2011 16:47
Brainfuck to C translator
/*
* A simple, non-optimizing brainfuck to C translator.
* 2010-08-31 - Version 1.0 (Cory Burgett)
*
* This code is hereby placed into the public domain.
*
* Originally located at: http://www4.ncsu.edu/~cmburget/brainfucc.c
*/
#include <stdio.h>
@sigmaSd
sigmaSd / installFn.ts
Last active September 6, 2022 01:25
Install a javascript function as an executable
import cache_dir from "https://deno.land/x/dir@1.5.1/cache_dir/mod.ts";
import { ensureDirSync } from "https://deno.land/std@0.152.0/fs/ensure_dir.ts";
export interface Options {
prelude?: string;
permissions?: string[];
}
// deno-lint-ignore no-explicit-any
export default function installFn(fn: any, options?: Options) {
@SiddharthShyniben
SiddharthShyniben / ninja-code.md
Last active October 25, 2022 09:35
Ninja Code from javascript.info. For my self reference.

Ninja code

Learning without thought is labor lost; thought without learning is perilous.

Confucius

Programmer ninjas of the past used these tricks to sharpen the mind of code maintainers.
Code review gurus look for them in test tasks.
Novice developers sometimes use them even better than programmer ninjas.
Read them carefully and find out who you are – a ninja, a novice, or maybe a code reviewer?

@sergiodxa
sergiodxa / async-thread.js
Last active June 27, 2023 05:38
Use WebWorkers and promises to run sync heavy functions in a worker (process) and get the result in a promise
function asyncThread(fn, ...args) {
if (!window.Worker) throw Promise.reject(
new ReferenceError(`WebWorkers aren't available.`)
);
const fnWorker = `
self.onmessage = function(message) {
(${fn.toString()})
.apply(null, message.data)
.then(result => self.postMessage(result));
@0atman
0atman / set-gnome-shell-hotkeys.sh
Created September 29, 2014 10:19
i3 gnome-shell keyboard bindings
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<alt>1']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-2 "['<alt>2']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-3 "['<alt>3']"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-4 "['<alt>4']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-1 "['<alt><shift>1']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-2 "['<alt><shift>2']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-3 "['<alt><shift>3']"
gsettings set org.gnome.desktop.wm.keybindings move-to-workspace-4 "['<alt><shift>4']"