Skip to content

Instantly share code, notes, and snippets.

@islishude
islishude / uniswap-airdrop.sol
Created December 9, 2020 03:44
uniswap airdrop contract 0x090d4613473dee047c3f2706764f49e0821d256e
/**
*Submitted for verification at Etherscan.io on 2020-09-16
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity =0.6.11;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
@ih2502mk
ih2502mk / list.md
Last active September 23, 2024 08:48
Quantopian Lectures Saved
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@jesster2k10
jesster2k10 / README.md
Last active September 18, 2024 00:56
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@axehomeyg
axehomeyg / sqlite_test_db_loader.rb
Created December 9, 2019 20:27
Rails 6 parallel minitest with sqlite3 :memory: databases.
#### evals the schema into the current process
class SqliteTestDbLoader
# assumes your schema is generated for MySQL
# tweak for Postgres!
MYSQL_REPLACEMENTS = {
/ENGINE=InnoDB DEFAULT CHARSET=[a-z0-9]*/ => '',
/, collation: "[^"]*"/ => ''
}
@krisleech
krisleech / HOWTO.md
Last active February 10, 2021 08:13
ActiveModel comforming Form object based on dry-type / dry-validation
require 'dry-validation'
require 'dry-struct'
require 'active_model/errors'

require_relative '../create_study'

module MyApp
  module Types
    include Dry::Types.module
anonymous
anonymous / sheets.js
Created November 4, 2017 15:46
function CaptureNetWorth() {
var USD_NW_COLUMN = 2;
var destinationSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Daily NW');
// Get index of the last row in column A that doesn't have content
var Avals = destinationSheet.getRange("A1:A").getValues();
var lastRowIndex = Avals.filter(String).length;
var newRowIndex = lastRowIndex + 1;
@logicalguess
logicalguess / state.go
Last active January 16, 2020 03:46
State Monad in Go.
package main
import (
"fmt"
"reflect"
)
type G interface{}
type S G
@klaaspieter
klaaspieter / ASS.md
Created June 22, 2017 07:59 — forked from anonymous/ASS.md
Acronyms Seriously Suck - Elon Musk

From time to time, Musk will send out an e-mail to the entire company to enforce a new policy or let them know about something that's bothering him. One of the more famous e-mails arrived in May 2010 with the subject line: Acronyms Seriously Suck:

There is a creeping tendency to use made up acronyms at SpaceX. Excessive use of made up acronyms is a significant impediment to communication and keeping communication good as we grow is incredibly important. Individually, a few acronyms here and there may not seem so bad, but if a thousand people are making these up, over time the result will be a huge glossary that we have to issue to new employees. No one can actually remember all these acronyms and people don't want to seem dumb in a meeting, so they just sit there in ignorance. This is particularly tough on new employees.

That needs to stop immediately or I will take drastic action - I have given enough warning over the years. Unless an acronym is approved by me, it should not enter the SpaceX glossary.

@stefansundin
stefansundin / heroku-replay.sh
Last active August 30, 2018 17:39
Replay production Heroku requests to your local dev environment.
#!/bin/bash -e
app=rssbox
dev=http://rssbox.dev
heroku logs -t -s heroku -d router -a $app | {
while IFS= read -r line
do
path=$(echo $line | grep -oE 'path="([^"]+)"' | cut -d'"' -f2)
code=$(curl -s -o /dev/null -w "%{http_code}" "$dev$path")