Skip to content

Instantly share code, notes, and snippets.

View jamesyoung's full-sized avatar
🤖
https://collab.land

James Young jamesyoung

🤖
https://collab.land
View GitHub Profile
@nginnever
nginnever / weth mods
Last active November 10, 2020 23:26
address constant public amb_mediator = 0x5275e7264AB0Bb75D970E7442De0Aadd0C0b85ae;
function depositAndBridge() external override payable returns (bool success) {
require(address(this).balance + flashSupply <= type(uint112).max, "WETH::deposit: supply limit exceeded");
// Create token balance for deposit
balanceOf[msg.sender] += msg.value;
// Approve the new tokens to the mediator contract
allowance[msg.sender][amb_mediator] = msg.value;
@fabdarice
fabdarice / Contract Verification & Publication
Last active August 23, 2022 10:30
Useful Solidity/Web3/Truffle commands
1) go to https://ropsten.etherscan.io/verifyContract?a=0xa32b21ba14fd476757e392db5d1bbc833eaedaf5
2) enter contract address, name, compiler
3) copy code of contract flatten out (delete import and replace by actual code)
4) truffle console
5) var Eth = require('ethjs')
6) Eth.abi.encodeParams(["uint256", "uint256", "uint256", "address", "uint256"], ["1508105298", "1508710098", "200", "0x3d208fabaf7e919985d5d2f068f28d6a9022e8d5", "5000000000000000000000000000"])
7) copy paste result of encodeParams without '0x'
@Georgi87
Georgi87 / StateChannel.sol
Last active February 2, 2018 20:49
Generalized settlement for state channels using proxy contracts.
pragma solidity ^0.4.0;
contract Token {
function transfer(address to, uint256 value) returns (bool);
function transferFrom(address from, address to, uint256 value) returns (bool);
}
/// @title State Channel contract - Allows multiple parties to settle off-chain transactions.
/// @author Stefan George - <[email protected]>
contract StateChannelProxy {
@demmer
demmer / README.md
Last active January 28, 2016 17:28
Juttle API Proxy Example

Juttle API Proxy

This is a simple proof-of-concept example of how one could embed Juttle-powered charts and visualizations in a custom application.

Installing / Running

Requires node.js to be installed.

@jparreira
jparreira / iot_to_realtime.js
Last active December 14, 2015 12:35
AWS Lambda function that send a message through the Realtime Messaging Platform
var https = require('https');
exports.handler = function(event, context) {
var appkey = 'YOUR_REALTIME_APPKEY';
var privatekey = 'YOUR_REALTIME_PRIVATEKEY';
var channel = 'aws-iot';
var message = JSON.stringify(event);
var postBody = "AK=" + appkey + "&PK=" + privatekey + "&C=" + channel + "&M=" + message;
var headers = {
@Siedrix
Siedrix / client.js
Created April 6, 2015 14:07
Tutum websocket examples
var WebSocket = require('ws');
var userPublicToken = 'apikey';
var username = 'username';
var ws = new WebSocket('wss://stream.tutum.co/v1/events?token='+ userPublicToken +'&user=' +username);
ws.on('open', function() {
console.log('Connected');
});
@rauchg
rauchg / effective-es6.md
Last active July 11, 2023 09:38
Writing ES6 today, effectively.

Effective transpiling of ES6

After publishing my article on ECMAScript 6, some have reached out to ask how I exactly I make it all work.

I refrained from including these details on the original post because they're subject to immiment obsoletion. These tools are changing and evolving quickly, and some of these instructions are likely to become outdated in the coming months or even weeks.

The main tool

When evaluating the available transpilers, I decided to use 6to5, which has recently been renamed to Babel. I chose it based on:

@StephanHoyer
StephanHoyer / gist:bddccd9e159828867d2a
Last active March 29, 2022 11:46
Isomorphic applications with mithril

Attention

This post described how to create an application with mithril 0.2.x. Now that ver 1.0 is out, some things are a little differnent.

The example is updated with the current version of mithril, though.

Isomorphic applications with mithril

@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@jerluc
jerluc / contents.markdown
Last active March 9, 2016 20:57
Open content linking proposal

On linking content across varying media

A brief history of hypertext documents

Many of the technologies being built today are based on the ideas initially conceived by post-World War II scientists. In fact, it was in July of 1945, when Dr. Vannevar Bush described the ["memex" device][2], a device with an uncanny resemblance to the Internet:

A memex is a device in which an individual stores all his books, records, and communications, and which is mechanized so that it may be consulted with exceeding speed and flexibility.

Only twenty years later in 1965, Ted Nelson, inspired by the same Dr. Bush, would conceive of the idea that content and documents should be ["hyperlinked"][3]. And finally in 1990, [Tim Berners-Lee along with some of his colleagues][4], would tie the concept of the hyperlink together with the idea of an inter-connected world to develop what we know now today as the Internet, allowing humankind to access and link information across vast distances almost instantly.

The disconnec