Skip to content

Instantly share code, notes, and snippets.

View sthobis's full-sized avatar
🏢
🙎‍♂️🎡

Stefanus Thobi Sinaga sthobis

🏢
🙎‍♂️🎡
View GitHub Profile
@joshnuss
joshnuss / app.js
Last active March 4, 2024 00:01
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
// Requiring our modules
var slackAPI = require('slackbotapi');
var request = require('request');
// Starting
var slack = new slackAPI({
'token': "xoxb-TOKENTOKENTOKENTOKEN",
'logging': true

(This is a brief summary of Ethereum's white paper)

Ethereum 101

What is Ethereum

Ethereum is a new cryptocurrency, like Bitcoin or Litecoin, that adds a number of new features. Most notably the inclusion of Agents (also known as Contracts); Independent Turing-complete programs that exist on the Ethereum blockchain. These Agents can receive Ether (Ethereum's currency) and other inputs, perform computations, hold balances, transfer Ether, and even activate other Agents.

Ethereum also attempts to fix some current issues with cryptocurenncy mining, such as rise of specialized hardware, large mining pools that aim to control the network, and the lack of reward for stale blocks, dissuading miners with weaker hardware.

Agents

@petehunt
petehunt / React sortable
Created December 9, 2013 22:30
Here's an example of React + jQuery UI sortable. The key thing to note is that we have the render() method do absolutely nothing and use componentDidUpdate() + React.renderComponent() to proxy updates through to the children. This lets us manage the DOM manually but still be able to use all the React goodies you know and love.
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://fb.me/react-0.5.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script>
</head>
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active March 27, 2024 06:36
A badass list of frontend development resources I collected over time.
.entypo-phone:before { content: "\1F4DE"; }
.entypo-mobile:before { content: "\1F4F1"; }
.entypo-mouse:before { content: "\E789"; }
.entypo-address:before { content: "\E723"; }
.entypo-mail:before { content: "\2709"; }
.entypo-paper-plane:before { content: "\1F53F"; }
.entypo-pencil:before { content: "\270E"; }
.entypo-feather:before { content: "\2712"; }
.entypo-attach:before { content: "\1F4CE"; }
.entypo-inbox:before { content: "\E777"; }
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"