Skip to content

Instantly share code, notes, and snippets.

View critesjosh's full-sized avatar
🥸

josh crites critesjosh

🥸
View GitHub Profile
@critesjosh
critesjosh / stockAPI.js
Created January 14, 2017 04:46
My API call from my stock exchange app
function apiCall(currentSymbol) {
var searchTerm;
if (currentSymbol) {
searchTerm = currentSymbol;
} else {
searchTerm = $('#searchTerm').val();
searchTerm = searchTerm.toUpperCase();
}
var url = "http://data.benzinga.com/rest/richquoteDelayed?symbols=" + searchTerm;
$('.loaderImage').show();
0x3fD3c54412E4263D65F76563fE7914efc9E85B9b
geth attach ipc:/home/josh/.ethereum/net42/geth.ipc

Keybase proof

I hereby claim:

  • I am critesjosh on github.
  • I am critesjosh (https://keybase.io/critesjosh) on keybase.
  • I have a public key whose fingerprint is 3ECD C2B2 55B9 9DE2 F7E5 03E3 5FC7 B319 582C 852F

To claim this, I am signing this object:

0x28C952e9E0c5bae016814E9Fbb4ad3841ca6d6B8
@critesjosh
critesjosh / Adoption.sol
Created January 10, 2018 21:52
Truffle pet shop tutorial contract
pragma solidity ^0.4.4;
contract Adoption {
address[16] public adopters;
// Adopting a pet
function adopt(uint petId) public returns (uint) {
require(petId >= 0 && petId <= 15);
@critesjosh
critesjosh / BaseCaller.sol
Last active August 20, 2021 13:42
Inter-contract execution in Solidity
pragma solidity ^0.5.0;
contract Base {
uint x;
constructor() public {
x = 10;
}
@critesjosh
critesjosh / Contract_calls.sol
Last active February 20, 2024 10:45
CALL vs CALLCODE vs DELEGATECALL in Solidity
pragma solidity ^0.4.15;
contract C1 {
uint public num;
address public sender;
function callSetNum(address c2, uint _num) public {
if(!c2.call(bytes4(sha3("setNum(uint256)")), _num)) revert(); // C2's num is set
}
@critesjosh
critesjosh / ThrowErrorExample.sol
Last active March 14, 2018 15:25
How to correctly throw errors in Solidity
pragma solidity ^0.4.0;
contract ThrowErrorExample {
bool isTrue = true;
uint num = 1;
//Bad code, do not emulate
function silentFail() public view returns (uint){
if(isTrue != true){
@critesjosh
critesjosh / Splitter.sol
Last active April 6, 2022 20:00
A contract to split funds between addresses. Demostrates pushing vs pulling transfers
pragma solidity ^0.4.6;
contract Splitter {
mapping(address => uint) public balances;
function unsafeSplit(address address1, address address2)
public
payable
returns(bool success)