Skip to content

Instantly share code, notes, and snippets.

@jlin27
jlin27 / example_0x_quote.json
Created January 28, 2023 01:29
Example quote from the 0x Swap API to buy DAI with 1 WETH
{
"chainId":1,
"price":"1596.8685376172358",
"guaranteedPrice":"1580.899852241063442",
"estimatedPriceImpact":"0.3366",
"to":"0xdef1c0ded9bec7f1a1670819833240f027b25eff",
"data":"0xd9627aa40000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000db64d8657ef60cb400000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f869584cd000000000000000000000000100000000000000000000000000000000000001100000000000000000000000000000000000000000000007495a7a91163d473a5",
"value":"0",
"gas":"111000",
"estimatedGas":"111000",
@jlin27
jlin27 / ga.sh
Last active February 18, 2020 21:43
Script to add Google Analytics tag
#!/bin/sh -e
# set -x #echo on
# inject-google-analytics
echo "Starting Script"
TRACKER_ID="UA-90545585-1"
TRACKER_CODE="
<!-- Google Analytics -->
@jlin27
jlin27 / code to go into NumbersFragment.java
Created May 14, 2016 00:34
Copy code from the NumbersActivity and paste it into the NumbersFragment
/** Handles playback of all the sound files */
private MediaPlayer mMediaPlayer;
/** Handles audio focus when playing a sound file */
private AudioManager mAudioManager;
/**
* This listener gets triggered whenever the audio focus changes
* (i.e., we gain or lose audio focus because of another app or device).
*/
@jlin27
jlin27 / onCreate method in MainActivity.java
Created April 7, 2016 18:13
Use OnClickListeners for All Categories - onCreate method in MainActivity.java
// Find the View that shows the numbers category
TextView numbers = (TextView) findViewById(R.id.numbers);
// Set a click listener on that View
numbers.setOnClickListener(new View.OnClickListener() {
// The code in this method will be executed when the numbers View is clicked on.
@Override
public void onClick(View view) {
Intent numbersIntent = new Intent(MainActivity.this, NumbersActivity.class);
startActivity(numbersIntent);