Skip to content

Instantly share code, notes, and snippets.

View dawsbot's full-sized avatar
💭
Bringing web3 to emerging markets - web3perf

Dawson Botsford dawsbot

💭
Bringing web3 to emerging markets - web3perf
View GitHub Profile
@mitsu-ksgr
mitsu-ksgr / ShebangList.md
Created October 18, 2014 17:17
【Markdown】shebang list

Shebang List

Mac OS X 10.9.x (Mavericks)

Shell
#!/usr/bin/env sh

Python
@dawsbot
dawsbot / image-minifier.sh
Last active December 20, 2019 16:40
Lossless image compression for all images in current directory
#!/bin/bash
# Minify all jpg and png images in current directory recursively
command_exists () {
type "$1" &> /dev/null ;
}
# Learn more about optipng at http://sweetme.at/2013/09/11/how-to-maximize-png-image-compression-with-optipng/
if command_exists optipng ; then
optipng -o2 -strip all **/*.png
else
@leesmith
leesmith / commit-message-syntax.txt
Created December 31, 2011 06:05
Pivotal Tracker post-commit message syntax
https://www.pivotaltracker.com/help/api?version=v3#github_hooks
https://www.pivotaltracker.com/help/api?version=v3#scm_post_commit_message_syntax
SCM Post-Commit Message Syntax
To associate an SCM commit with a specific Tracker story, you must include a special syntax in the commit message to indicate one or more story IDs and (optionally) a state change for the story. Your commit message should have square brackets containing a hash mark followed by the story ID. If a story was not already started (it was in the "not started" state), a commit message will automatically start it. For example, if Scotty uses the following message when committing SCM revision 54321:
[#12345677 #12345678] Diverting power from warp drive to torpedoes.
@smashingpat
smashingpat / action-types.ts
Created October 23, 2018 11:29
Typescript Redux actionTypes
import { Dispatch } from 'redux';
type StoreState = any; // preferable this should be the real Type of the store
/** Default action with just the type */
interface Action<T extends string> {
readonly type: T;
}
/** Action extended with a payload that could be any value, used for the reducer */
@PatrickAlphaC
PatrickAlphaC / bytesManipulation.sol
Last active October 22, 2020 04:20
Two helper functions to deal with bytes
pragma solidity ^0.7.0;
library bytesSwap {
string public test_string = "hello";
function bytes32ToString(bytes32 _bytes32) public pure returns (string memory) {
uint8 i = 0;
while(i < 32 && _bytes32[i] != 0) {
i++;
}
@wesbos
wesbos / settings.json
Created July 21, 2015 13:46
Wes Bos' Sublime Text Settings
{
"added_words":
[
"Mockup",
"plugins",
"coffeescript",
"sourcemaps",
"html",
"plugin",
"init",
@markerikson
markerikson / react-controlled-inputs.md
Last active June 15, 2021 12:50
React "controlled" vs "uncontrolled" inputs explanation

[12:03 AM] acemarke: "controlled" and "uncontrolled" inputs
[12:04 AM] acemarke: if I have a plain, normal HTML page, and I put <input id="myTextbox" type="text" /> in my page(edited)
[12:04 AM] acemarke: and I start typing into that textbox
[12:04 AM] acemarke: it remembers what I've typed. The browser stores the current value for that input
[12:05 AM] acemarke: and then sometime later, I can get the actual element, say, const input = document.getElementById("myTextbox"), and I can ask it for its value: const currentText = input.value;
[12:05 AM] acemarke: good so far?
[12:08 AM] acemarke: I'll keep going, and let me know if you have questions
[12:08 AM] lozio: ok, actually I'm reading
[12:09 AM] lozio: good
[12:09 AM] acemarke: so, a normal HTML input field effectively stores its own value at all times, and you can get the element and ask for its value

@rsms
rsms / optional.ts
Created July 28, 2017 16:11
Make a TypeScript interface completely optional
// Optional declares a type of keyed type T where all keys are optional.
// This allows
type Optional<T> = { [P in keyof T]? :T[P] }
interface Foo {
x :number
y :number
}
type OptionalFoo = Optional<Foo>
@radiovisual
radiovisual / .eslintrc
Last active October 30, 2021 11:55
React Native AirBnB ESLint Config
{
"parser": "babel-eslint",
"plugins": [
"react",
"react-native"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
@herr-vogel
herr-vogel / material-ui-next-js-button.js
Last active November 16, 2021 10:14
Using Material-UI Button with Next.js Link
import React from 'react'
import Link from 'next/link'
import Button from '@material-ui/core/Button'
const ButtonLink = ({ className, href, hrefAs, children, prefetch }) => (
<Link href={href} as={hrefAs} prefetch>
<a className={className}>
{children}
</a>
</Link>