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
@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:

@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');
});
@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 = {
@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.

@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 {
@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'
@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;