Skip to content

Instantly share code, notes, and snippets.

View lukecurtis93's full-sized avatar

Luke Curtis lukecurtis93

View GitHub Profile
@lukecurtis93
lukecurtis93 / deploy2.js
Created March 16, 2022 22:26
Upgrading a contract
const { ethers, upgrades } = require('hardhat');
async function main () {
const MyToken2 = await ethers.getContractFactory('MyToken2');
await upgrades.upgradeProxy('THECONTRACTADDRESS', MyToken2);
console.log('Contract upgraded');
}
main();
@lukecurtis93
lukecurtis93 / deploy.ts
Created March 16, 2022 22:23
Deploying an upgradable contract
const { ethers, upgrades } = require('hardhat');
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
// If this script is run directly using `node` you may want to call compile
// manually to make sure everything is compiled
// await hre.run('compile');
@lukecurtis93
lukecurtis93 / MyToken.sol
Last active March 21, 2022 14:34
An upgradeable token.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
contract MyToken is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, AccessControlUpgradeable, OwnableUpgradeable {
@lukecurtis93
lukecurtis93 / docker-compose.yml
Created July 2, 2021 10:50
Laravel Valet & Kafka/Kakfa UI Docker
---
# Required packages for PHP & C libraries if you want your Laravel app to talk to this from valet
#https://github.com/edenhill/librdkafka
#https://github.com/arnaud-lb/php-rdkafka
version: '2'
services:
zookeeper-1:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
@lukecurtis93
lukecurtis93 / AndroidReceiptValidtionController.php
Created May 8, 2020 05:58
Validate a Android subscription with a token and subscription ID
<?php
namespace App\Http\Controllers\Api\v1;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Services\ValidateAndroidSubscription;
use ReceiptValidator\GooglePlay\Validator as PlayValidator;
use \Google_Client as GoogleClient;
use \Google_Service_AndroidPublisher as AndroidPublisher;
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Arr;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use ReceiptValidator\iTunes\Validator as iOSValidator;
class iOSReceiptValidationController extends Controller
@lukecurtis93
lukecurtis93 / App.js
Last active April 6, 2020 05:53
Context
import { Provider as AuthProvider } from "./src/context/AuthContext";
return loaded ? (
<AuthProvider>
<NavigationContainer
theme={scheme === "dark" || darkModeSelected ? DarkTheme : LightTheme}
>
<Stack.Navigator>
<Stack.Screen
name="ResolveAuth"
@lukecurtis93
lukecurtis93 / UserSubscriptionRepositoryTest.php
Last active September 9, 2021 11:18
Mock Stripe in a Test
<?php
namespace Tests\Unit;
use Illuminate\Foundation\Testing\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;
class UserSubscriptionRepositoryTest extends TestCase
{
use CreatesApplication, RefreshDatabase;
@lukecurtis93
lukecurtis93 / TestCase.php
Created March 8, 2020 23:03
Mock Stripe API with Mockery & Laravel
<?php
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Stripe\Customer;
use Stripe\Stripe;
/**
* Class TestCase.
@lukecurtis93
lukecurtis93 / script.sh
Created March 3, 2020 23:36
SED A database with different encoding
sed -E "s/(X'[^,\)]*')/CONVERT(\1 using utf8mb4)/g" ~/Desktop/rocheledb_2020-02-18.sql > ~/Desktop/outfile.sql