Skip to content

Instantly share code, notes, and snippets.

View pigoz's full-sized avatar
:octocat:

Stefano Pigozzi pigoz

:octocat:
View GitHub Profile
@tombruijn
tombruijn / ginit.vim
Created October 9, 2021 14:31
neovim-qt macOS config
" macOS config used for neovim-qt, as far I tested to reproduce some basic behavior: https://github.com/equalsraf/neovim-qt
" Enable Mouse
set mouse=a
" Set Editor Font
if exists(':GuiFont')
" Use GuiFont! to ignore font errors
" GuiFont {font_name}:h{size}
GuiFont Meslo\ LG\ M\ for\ Powerline:h16
@acutmore
acutmore / README.md
Last active January 21, 2024 20:30
Emulating a 4-Bit Virtual Machine in (TypeScript\JavaScript) (just Types no Script)

A compile-time 4-Bit Virtual Machine implemented in TypeScript's type system. Capable of running a sample 'FizzBuzz' program.

Syntax emits zero JavaScript.

type RESULT = VM<
  [
    ["push", N_1],         // 1
    ["push", False],       // 2
 ["peek", _], // 3
@pigoz
pigoz / useMedia.tsx
Last active February 26, 2019 18:51
useMedia implementation with React Hooks and TypeScript
import React, { useState, useEffect, useContext } from "react";
type MediaQueries = { [s: string]: MediaQueryList };
type MediaT<T> = { [X in keyof T]: boolean };
function mapValues<T extends object, R>(
object: T,
mapper: (x: T[keyof T], key: keyof T, object: T) => R
): { [K in keyof T]: R } {
const result = {};
@siklodi-mariusz
siklodi-mariusz / Dockerfile
Created January 30, 2018 19:40
Dockerfile example for Ruby on Rails running on Alpine Linux
FROM ruby:2.4-alpine3.7
# Install dependencies:
# - build-base: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - postgresql-dev postgresql-client: Communicate with postgres through the postgres gem
# - libxslt-dev libxml2-dev: Nokogiri native dependencies
# - imagemagick: for image processing
RUN apk --update add build-base nodejs tzdata postgresql-dev postgresql-client libxslt-dev libxml2-dev imagemagick
@jiayihu
jiayihu / action-lifecycle.middleware.ts
Created March 9, 2017 14:32
Allow subscription, as Promise, to redux-saga and redux-observable POJO actions
import { Middleware } from 'redux';
export interface IActionLifecycle {
resolveType: string;
rejectType: string;
}
/**
* Middleware which allows to chain async actions as Promises.
* @see https://github.com/redux-observable/redux-observable/issues/90
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@ryanseddon
ryanseddon / cli.bash
Created October 9, 2015 05:44
Mocha compiler for css-module support in tests using sass
mocha --compilers js:babel/register,js:./test/css-modules-compiler.js --recursive -w
@tenderlove
tenderlove / h2_puma.rb
Last active September 4, 2023 17:30
Demo HTTP/2 server with Puma
require 'socket'
require 'openssl'
require 'puma/server'
require 'ds9'
class Server < DS9::Server
def initialize socket, app
@app = app
@read_streams = {}
@write_streams = {}