Skip to content

Instantly share code, notes, and snippets.

contract;
abi ProxyAbi {
#[storage(read)]
fn read_val() -> u64;
#[storage(write)]
fn write_target(target: ContractId);
}
#[namespace(proxy_47892374)]
@IGI-111
IGI-111 / easing.js
Created January 30, 2019 15:24 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
const DemoData = {
resources: [{
id: 'r1',
name: 'Interventions'
}],
events: [{
"id": 15,
"start": "2018-07-05T07:00:00Z",
"end": "2018-07-05T08:00:00.000Z",
"resourceId": "r1",
function stockPicker(market) {
let lowest_index = 0;
const lowest_previous_index = market.map((x, i) => {
if (x < market[lowest_index]) {
lowest_index = i;
}
return lowest_index;
});
let best = {
@IGI-111
IGI-111 / vigenere.js
Created October 11, 2017 12:42
Vigenere cypher solver
const fs = require('fs');
const englishFrequency = [
0.08167,
0.01492,
0.02782,
0.04253,
0.12702,
0.02228,
0.02015,
@IGI-111
IGI-111 / category_theory.md
Last active September 12, 2023 19:32
"category theory for programmers" blog post series parsed into markdown and formatted in a pdf

Category Theory for Programmers: The Preface

Table of Contents

Part One

@IGI-111
IGI-111 / pyramid.rs
Last active August 29, 2017 08:32
Shortest pyramid path
use std::env;
use std::io::Read;
use std::fs::File;
use std::cmp;
pub fn main() {
let args: Vec<String> = env::args().collect();
let mut file = File::open(&args[1]).unwrap();
let mut contents = String::new();
file.read_to_string(&mut contents).unwrap();
#include <stdlib.h>
#include <string.h>
#include "term.h"
/* Eterm */
static const char *Eterm_keys[] = {
"\033[11~","\033[12~","\033[13~","\033[14~","\033[15~","\033[17~","\033[18~","\033[19~","\033[20~","\033[21~","\033[23~","\033[24~","\033[2~","\033[3~","\033[7~","\033[8~","\033[5~","\033[6~","\033[A","\033[B","\033[D","\033[C", 0
};
static const char *Eterm_funcs[] = {
@IGI-111
IGI-111 / qr-braille.js
Created December 5, 2016 13:43
Make a QR code with braille characters.
const qr = require('qrcode');
const Canvas = require('drawille');
qr.drawBitArray(process.argv[2], (err,bits,width) => {
if(err){
console.error(err);
return;
}
let height = Math.ceil(bits.length / width);
@IGI-111
IGI-111 / levenstein.cpp
Created October 20, 2016 15:02
Levenstein distance
#include <algorithm>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
namespace {
using Iter = std::string::const_iterator;