Skip to content

Instantly share code, notes, and snippets.

Paul Carduner pcardune

Block or report user

Report or block pcardune

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pcardune
pcardune / Cloneable.ts
Created Jul 12, 2018
Example of some complicated typescript typings
View Cloneable.ts
class Cloneable<T extends object> {
protected readonly data: T;
public static kind: string;
protected constructor(data: T) {
this.data = data;
}
static create<T extends object>(data: T) {
console.log('Creating a cloneable', this.kind);
@pcardune
pcardune / main.go
Created Jul 1, 2018
Clifford Attractor Animation
View main.go
// after running this program you can run
// ffmpeg -framerate 30 -i out/%06d.jpg -c:v libx264 -r 30 -pix_fmt yuv420p out2.mp4
package main
import (
"fmt"
"image"
"image/color"
"image/jpeg"
"math"
@pcardune
pcardune / ipld-test.js
Last active Feb 15, 2018
Simple example of storing data in your local ipfs node using ipld. Note that this only works when your local ipfs node is not running.
View ipld-test.js
import dagCBOR from 'ipld-dag-cbor';
import IPLDResolver from 'ipld-resolver';
import BlockService from 'ipfs-block-service';
import IPFSRepo from 'ipfs-repo';
const repo = new IPFSRepo(process.env.HOME + '/.ipfs');
const ipfsBlockService = new BlockService(repo);
const resolver = new IPLDResolver(ipfsBlockService);
const node1 = {
View identity.jsx
/* @flow */
type IdentityFunc = <A>(a: A) => A;
declare var identity: IdentityFunc;
const aNumber:number = identity(1);
const aString:string = identity("foo");
View identity.jsx
/* @flow */
type IdentityFunc<A> = (a: A) => A;
declare var identity: IdentityFunc<mixed>;
const aNumber:number = identity(1);
const aString:string = identity("foo");
View identity.jsx
/* @flow */
type IdentityFunc<A> = (a: A) => A;
declare var identity: IdentityFunc<number>;
const aNumber:number = identity(1);
const aString:string = identity("foo");
View identity.js
function identity(a) {
return a;
}
@pcardune
pcardune / redux_v3.x.x.jsx
Last active Apr 27, 2017
This gist shows how to add support for redux-thunk and redux-promise-middleware to the flowtype libdefs for redux
View redux_v3.x.x.jsx
// flow-typed signature: ba132c96664f1a05288f3eb2272a3c35
// flow-typed version: c4bbd91cfc/redux_v3.x.x/flow_>=v0.33.x
declare module 'redux' {
/*
S = State
A = Action
You can’t perform that action at this time.