Skip to content

Instantly share code, notes, and snippets.

View wh1100717's full-sized avatar

Eric Wang wh1100717

  • Shenzhen, China
View GitHub Profile
@gorgos
gorgos / MultiSwap.sol
Created August 22, 2021 11:04
Example for how to swap multiple tokens in one on Ropsten
// SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma abicoder v2;
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/ISwapRouter.sol";
import "https://github.com/Uniswap/uniswap-v3-periphery/blob/main/contracts/interfaces/IQuoter.sol";
import {IERC20, SafeERC20} from "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.4-solc-0.7/contracts/token/ERC20/SafeERC20.sol";
interface IUniswapRouter is ISwapRouter {
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

@JacksonTian
JacksonTian / benchmark.md
Last active August 29, 2015 14:06
call_vs_apply

script:

$ cat server.js 
var http = require('http');

http.createServer(function (req, res) {
  res.writeHead(200);
  res.write('hello world!');
 res.end();
@djyde
djyde / ggrss.js
Last active January 3, 2016 19:29
Parse RSS only in Javascript
//It depends on Google Feed API
//Check <script type="text/javascript" src="https://www.google.com/jsapi"></script> is included in HTML
var ggrss = (function(){
var cache = [];
return {
parse: function(url,num,callback){
google.load("feeds","1");
//I found that google.load() should not be called while your page is ready, or the page will be cleared
@defunkt
defunkt / clients.md
Created April 18, 2010 14:09
A list of Gist clients.

Gist Clients

Want to create a Gist from your editor, the command line, or the Services menu? Here's how.

Editor Support