Skip to content

Instantly share code, notes, and snippets.

View LongLiveCHIEF's full-sized avatar

Brian Vanderbusch LongLiveCHIEF

View GitHub Profile
@LongLiveCHIEF
LongLiveCHIEF / git-amend
Last active May 18, 2022 13:28 — forked from esebastian/git-amend
Amend the commit message of one specific git commit and rebase to apply the changes
#!/bin/sh
# Amend the commit message one specific commit and rebase
# to apply the changes. Given the SHA hash or a reference
# of the commit to amend, it checkouts the commit, amends
# it interactively and rebases the repo history in current branch.
#
currentbranch=$(git branch --show-current)
@LongLiveCHIEF
LongLiveCHIEF / createCtx-noNullCheck.tsx
Created January 31, 2022 16:35 — forked from swyxio/createCtx-noNullCheck.tsx
better createContext APIs with setters, and no default values, in Typescript. this is documented in https://github.com/typescript-cheatsheets/react-typescript-cheatsheet/blob/master/README.md#context
// create context with no upfront defaultValue
// without having to do undefined check all the time
function createCtx<A>() {
const ctx = React.createContext<A | undefined>(undefined)
function useCtx() {
const c = React.useContext(ctx)
if (!c) throw new Error("useCtx must be inside a Provider with a value")
return c
}
return [useCtx, ctx.Provider] as const
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
{
"description": "This is my Vagrant box, it's an example of what you can do with a custom Vagrant Cloud.",
"short_description": "This is my Vagrant box.",
"name": "myorg/mybox",
"versions": [
{
"version": "1.0.0",
"status": "active",
"description_html": null,
"description_markdown": "",
@LongLiveCHIEF
LongLiveCHIEF / Converting libraries to Ember CLI addons.md
Created December 4, 2015 20:00 — forked from kristianmandrup/Converting libraries to Ember CLI addons.md
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

/** @jsx React.DOM */
var RenderedDeck = React.createClass({
render: function() {
return <div id={this.props.id} className="deck" dangerouslySetInnerHTML={{__html:this.props.contents}}></div>;
}
});
var Deck = React.createClass({
render: function() {

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
#!/usr/bin/env python
"""
This script helps migrating issues from Bitbucket to GitHub.
It currently ignores milestones completly and doesn't care whether an issue is
open, new or on hold. As long as it's not closed it's considered open.
To use it, install python-bitbucket, PyGithub and ipdb.