Skip to content

Instantly share code, notes, and snippets.

@itrelease
itrelease / Buffer Overflow Tutorial in Kali.md
Created March 29, 2017 23:11 — forked from apolloclark/Buffer Overflow Tutorial in Kali.md
Buffer overflow demonstration in Kali Linux, based on the Computerphile video
@itrelease
itrelease / bloop.js
Last active August 29, 2015 14:25 — forked from jlongster/bloop.js
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
/* @flow */
type State = Object
type Action = {type: string | void}
type AsyncAction = (performAction: FluxPerformFunction, state: State) => void
type ActionCreator = () => Action | AsyncAction
type StoreFunction = (state: State, action: Action) => State
/**
* Stores are just seed + reduce function.
* Notice they are plain objects and don't own the state.
*/
const countUpStore = {
seed: {
counter: 0
},
reduce(state, action) {
@itrelease
itrelease / Stateful.js
Last active August 29, 2015 14:19 — forked from gaearon/Stateful.js
import React, { Component } from 'react';
// Usage:
//
// @Stateful({
// initialize(props) {
// return {
// count: 0
// };
// },
export default {
getInitialState() {
const data = {};
this.subscribe(this.props, this.context, (key, value) => {
data[key] = value;
});
this.unsubscribe();
return { data };
// Usage example:
//
// willTransitionTo(transition, params) {
// transition.wait(
// observeStore(
// DraftStore,
// s => s.isLoaded()
// ).then(() => {
// if (DraftStore.isMissingTitle()) {
// transition.redirect('composeDraft', params);

Virtual DOM and diffing algorithm

There was a [great article][1] about how react implements it's virtual DOM. There are some really interesting ideas in there but they are deeply buried in the implementation of the React framework.

However, it's possible to implement just the virtual DOM and diff algorithm on it's own as a set of independent modules.

(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}
/**
* Automatic Reference Counting (ARC) Garbage Collection technique.
*
* This diff describes Reference counting GC technique.
* See also previous lesson on Mark and Sweep GC:
* https://gist.github.com/4391763
*
* Covered topics:
*
* 1. Reference value in ECMAScript (JS specific)