This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The /dev/null forces grep to have multiple file names so it tricks the output into listing the files their names | |
grep ${REPLACE-ME} /dev/null * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A simple DSL for createing dependency injected modules/classes. | |
module Opaque::Injector | |
# Full DSL setup, this creates a module for dependencies dynamically. | |
# | |
# ``` | |
# include Injector | |
# | |
# dependencies do | |
# dependency :logger, Logger.new(STDOUT, Logger::INFO) | |
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte incomingBytes[32]; | |
byte powerOn[] = {0x6, 0x01, 0x00, 0x19, 0x02, 0x1C}; | |
byte powerOff[] = {0x6, 0x01, 0x00, 0x19, 0x01, 0x1F}; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(LED_BUILTIN, OUTPUT); | |
digitalWrite(LED_BUILTIN, LOW); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const useDidUpdate = () => { | |
const isNotMounted = useRef(true); | |
useEffect(() => { | |
if (isNotMounted.current) { | |
isNotMounted.current = false; | |
} | |
}); | |
return !isNotMounted.current; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Store { | |
constructor(reducer) { | |
const [state, dispatch] = reducer; | |
this.state = Object.freeze(state); | |
this._dispatch = dispatch; | |
this._effectFunc = null; | |
} | |
dispatch(action) { | |
const prevState = Object.freeze({ ...this.state }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# General Shortcuts | |
alias wifi="wicd-curses" | |
alias connections="sudo iftop -i wlp4s0" | |
alias restart-network="sudo service network-manager restart" | |
alias work="cd ~/Workspace" | |
alias dc="docker-compose" | |
# Mistake Shortcuts | |
alias gti="git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# General Shortcuts | |
alias wifi="wicd-curses" | |
alias connections="sudo iftop -i wlp4s0" | |
alias restart-network="sudo service network-manager restart" | |
alias work="cd ~/Workspace" | |
alias dc="docker-compose" | |
# Mistake Shortcuts | |
alias gti="git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import isEqual from "lodash/isEqual"; | |
// Types for testing | |
import { ICartItem } from "../types/Cart"; | |
import createStore from '../helpers/createStore'; | |
type State = ICartItem[]; | |
type Action = | |
| { type: "add" | "remove", item: ICartItem } | |
| { type: "clear" }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const buildQueryParams = (params) => ( | |
Object | |
.keys(params) | |
.reduce((q, k) => q + `${k}=${params[k]}&`, '?') | |
.slice(0, -1) | |
); | |
// Usage: | |
const queryParams = buildQueryParams({ | |
hello: 'world', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { componentFactory } from 'vue-tsx-support'; | |
import { VNode } from 'vue'; | |
type Styles = string | Array<string>; | |
interface WrapperProps { | |
as?: string; | |
} | |
export default ( |