Skip to content

Instantly share code, notes, and snippets.

View abiodun0's full-sized avatar

Abiodun abiodun0

View GitHub Profile
@abiodun0
abiodun0 / gcd.rs
Last active February 16, 2018 01:19
Greatest common divisor in '.wasm'
#![feature(lang_items)]
#![no_std]
#[no_mangle]
pub extern "C" fn gcd(mut n: i32, mut m: i32) -> i32 {
assert!(n != 0 && m != 0);
while m != 0 {
if m < n {
let t = m;
m = n;
@abiodun0
abiodun0 / Dream Role.md
Created February 14, 2018 18:03
Dream Role

Functional Compiler Engineer Location: Remote IOHK is looking for a talented, functional compiler engineer to join our growing in-house team. In this full time, remote work opportunity the candidate will be responsible for designing and implementing functional programming languages for next-generation blockchain smart contract systems.

The individual will work closely with our Programming Language Theory (PLT) and cryptography researchers, our formal methods team and our engineering team throughout the smart contracts development programme involving design, coding, testing and integrating of a new smart scripting languages into our blockchain technology. We also plan to design and implement relevant Domain Specific Languages (DSLs). The individual should have a strong understanding of programming language design, type systems, operational semantics, interpreters and compiler implementation techniques.

Our ideal candidate will play a key role in Project Goguen and be responsible for design and implementati

@abiodun0
abiodun0 / postactivate
Created January 17, 2018 16:20 — forked from manuganji/postactivate
virtualenv postactivate and postdeactivate files for django. Place these files at $VIRTUAL_ENV/bin. That is inside the bin folder inside the virtualenv directory
#!/bin/bash
# This hook is run after this virtualenv is activated.
# Place this file at $VIRTUAL_ENV/bin
# I usually drop something like this into my virtualenv's postactivate for some
# quick and handy shortcuts to common Django commands.
# This way dropping in to do some work on any arbitrary project is as easy as:
# 1. workon <project name>
# 2. djr
@abiodun0
abiodun0 / Infrastructure.js
Created January 16, 2018 15:20 — forked from sebmarkbage/Infrastructure.js
SynchronousAsync.js
let cache = new Map();
let pending = new Map();
function fetchTextSync(url) {
if (cache.has(url)) {
return cache.get(url);
}
if (pending.has(url)) {
throw pending.get(url);
}
@abiodun0
abiodun0 / switchReducer.js
Last active January 7, 2018 04:13
switch and object lookup redux
//You can use an object as a lookup table instead
const handlers = {
ADD_ITEM(state, action) { ... }
REMOVE_ITEM(state, action) { ... }
}
function itemReducer (state, action) {
if (action.type in handlers) {
@abiodun0
abiodun0 / getPinStyleAnimation.js
Last active January 6, 2018 01:19
requestAnimation
function getPinStyle (pin, scrollPosition) {
// do some calculation based on the pin that was passed in and the current scroll position
return { rotate, scale, translate }
}
requestAnimationFrame(function frame () {
pins.forEach(pin => applyPinStyles(pin, getPinStyle(pin, window.scrollTop)))
requestAnimationFrame(frame)
})
@abiodun0
abiodun0 / ApiAbstract.js
Last active December 7, 2017 16:06
some interesting api abstraction
import Path from 'path-parser'
import { isTokenExpired } from './auth0Utils'
import { HttpForbiddenError, UnauthorizedError } from './errors'
const GET = 'GET'
const PUT = 'PUT'
const POST = 'POST'
const PATCH = 'PATCH'
const DELETE = 'DELETE'
const FANCY_METHODS = new Set([ PATCH, PUT, DELETE ])
@abiodun0
abiodun0 / reduxFromRx.js
Created November 11, 2017 02:03
ReduxFromRx
// A very simple wrapper that provides redux-like functionality using RxJS observables
// Redux is basically just an observable(subject), except that it's not generic enough to be used like one.
// By using RxJS observables, you can solve many of the problems that redux has, such as asynchronous effects,
// in a very simple way. Since it's using an observable, it's easy to combine and compose the store with other streams
// like events or ajax calls.
// This simple wrapper provides the same functionality as redux at only 23 lines of code
const createStore = function(name, reducer, initialState) {
const storeName = 'store:'+ name
@abiodun0
abiodun0 / interpose.js
Created November 2, 2017 08:18
interpose funciton
const interpose = (separator, array) => [].concat.apply([], array.map(item => [separator, item])).slice(1)
@abiodun0
abiodun0 / monoid.js
Created October 24, 2017 07:33
This is a simple monoid structure for basic operations of average, addition, product and max
// Definining a simple monoid structure for addtions, multiply and Max utility
var number = [1, 2, 3];
const Sum = (x) => ({
append: (y) => Sum(x + y.val),
val: x
})
Sum.Identity = Sum(0);
const Multiply = (x) => ({