Skip to content

Instantly share code, notes, and snippets.

View skplunkerin's full-sized avatar
🐰
Working W02K1N6 01110111 01101111 01110010 01101011 01101001 01101110 01100111

Skplunkerin skplunkerin

🐰
Working W02K1N6 01110111 01101111 01110010 01101011 01101001 01101110 01100111
View GitHub Profile
@skplunkerin
skplunkerin / readme.md
Last active March 27, 2019 15:44
terminal / bash curl -I redirect check ping

Check to see if redirect is from cached browser, or server.

$ curl -I google.com
HTTP/1.1 301 Moved Permanently
Location: http://www.google.com/
Content-Type: text/html; charset=UTF-8
Date: Thu, 13 Dec 2018 20:55:25 GMT
Expires: Sat, 12 Jan 2019 20:55:25 GMT
Cache-Control: public, max-age=2592000
@skplunkerin
skplunkerin / README.md
Created April 17, 2019 16:35
rails new create rails api
rails new my_project_name --api
@skplunkerin
skplunkerin / test.md
Created July 30, 2019 14:33
rails test specific file line

For rails 5:

source

Specific test file:

rails test test/models/my_model.rb

Specific test in file:

@skplunkerin
skplunkerin / gsheets.md
Last active May 26, 2021 17:05
google sheets gsheets spreadsheets tips
@skplunkerin
skplunkerin / UnmarshalJSON.md
Last active August 3, 2020 14:24
go golang custom unmarshal json string time

Strings in JSON Unmarshal

Quick note on this. JSON will add extra wrapping " quotes to strings which can really mess with you.

How to catch and remove the extra wrapping "'s:

example playground code

// UnmarshalJSON scrubs out whitespace from a valid json string, if any.
@skplunkerin
skplunkerin / delve.md
Last active July 3, 2020 17:13
vscode delve dlv breaking debug mode debugger

VS Code GO - Delve error:

NOTE: /.../ is the full path to my project.

Error message:

could not launch process: open /.../cmd/server/debug.test: no such file or directory
could not remove /.../cmd/server/debug.test: remove /.../cmd/server/debug.test: no such file or directory
Process exiting with code: 1
@skplunkerin
skplunkerin / phone.md
Created September 8, 2020 12:53
fake test phone numbers

Source

Only 555-0100 through 555-0199 are now specifically reserved for fictional use; the other numbers have been reserved for actual assignment.

@skplunkerin
skplunkerin / if_exists.md
Created October 21, 2020 21:27
golang empty struct{} uses less memory, perfect for if exists ok checks

An empty struct struct{} uses 0 memory:

More on it here https://dave.cheney.net/2014/03/25/the-empty-struct.

It can be used with channels as well if you just want to notify whatever is listening on a channel that something happened and not to transfer data between goroutines.

// DO NOT DO THIS: (it uses more memory)
func removeDuplicateUsers(users []User) []User {
	u := map[string]bool{}
@skplunkerin
skplunkerin / helloworld.sol
Last active November 23, 2021 23:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity 0.8.7;
contract HelloWorld {
// called state variables:
// string message;
// CONSTRUCTORS
// https://academy.moralis.io/lessons/constructors-2
// runs only 1x during compile.
// constructor(string memory _msg){
@skplunkerin
skplunkerin / data_location-memory_assignment.sol
Last active November 25, 2021 18:30
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// See feedback: https://gist.github.com/skplunkerin/61fe0562a72016162aece7b22609fb62
pragma solidity 0.8.7;
contract MemoryAndStorage {
struct User{
uint id;
uint balance;
}