Skip to content

Instantly share code, notes, and snippets.

View matthewjberger's full-sized avatar
🦀
Programming something in Rust, probably

Matthew J. Berger matthewjberger

🦀
Programming something in Rust, probably
View GitHub Profile
@matthewjberger
matthewjberger / EventDispatcher.cpp
Created May 6, 2016 20:01 — forked from sansumbrella/EventDispatcher.cpp
C++ observer pattern for event handling.
#include "EventDispatcher.h"
void EventDispatcher::addListener( Listener *l )
{
mListeners.push_back(l);
}
void EventDispatcher::removeListener( Listener *l )
{
mListeners.erase( std::remove( mListeners.begin(), mListeners.end(), l ), mListeners.end() );
@matthewjberger
matthewjberger / .gitconfig
Created May 18, 2016 02:20 — forked from putermancer/.gitconfig
git aliases
[alias]
man = help
unadd = reset HEAD
#co = checkout
co = "!f(){ git checkout \"$@\" && git sup; }; f"
feature = "!git reset HEAD && git checkout -b feature/\"$1\" && git commit --allow-empty -m \"Created feature branch $1\" && git push --set-upstream origin feature/\"$1\" && echo Branch feature/$1 published to origin"
cp = cherry-pick
sma = submodule add
st = status
br = branch
@matthewjberger
matthewjberger / git-recover-branch.md
Created May 19, 2016 05:29 — forked from jbgo/git-recover-branch.md
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@matthewjberger
matthewjberger / RecursiveReplace.ps
Created June 16, 2016 14:22 — forked from jongalloway/RecursiveReplace.ps
Recursive replace in files (PowerShell)
$find = 'jquery-1\.4\.4'
$replace = 'jquery-1\.5\.1'
$match = '*.cshtml' , '*.vbhtml'
$preview = $true
foreach ($sc in dir -recurse -include $match | where { test-path $_.fullname -pathtype leaf} ) {
select-string -path $sc -pattern $find
if (!$preview) {
(get-content $sc) | foreach-object { $_ -replace $find, $replace } | set-content $sc
}
@matthewjberger
matthewjberger / gnome-terminal-zenburn.sh
Created July 20, 2016 06:17 — forked from planbnet/gnome-terminal-zenburn.sh
Zenburn color scheme for gnome-terminal
#!/usr/bin/env bash
dir=$(dirname $0)
gconfdir=/apps/gnome-terminal/profiles
echo # This makes the prompts easier to follow (as do other random echos below)
########################
### Select a profile ###
########################
@matthewjberger
matthewjberger / auto-deploy.md
Created August 8, 2016 04:16 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

; ___ _ __ ___ __ ___
; / __|_ _ __ _| |_____ / /| __|/ \_ )
; \__ \ ' \/ _` | / / -_) _ \__ \ () / /
; |___/_||_\__,_|_\_\___\___/___/\__/___|
; An annotated version of the snake example from Nick Morgan's 6502 assembly tutorial
; on http://skilldrick.github.io/easy6502/ that I created as an exercise for myself
; to learn a little bit about assembly. I **think** I understood everything, but I may
; also be completely wrong :-)
solution "SDL2_Test"
configurations { "debug", "release" }
location("make/" .. os.get() .. "/")
targetdir("bin/" .. os.get() .. "/%{cfg.buildcfg}/")
objdir("obj/" .. os.get() .. "/%{cfg.buildcfg}/")
project "sdl2_test"
kind "WindowedApp"
language "C"
@matthewjberger
matthewjberger / .bashrc
Created October 2, 2016 01:51 — forked from mystor/.bashrc
Spacemacs configuration for rust
# You could also do this in emacs probably, but this is easier.
export RUST_SRC_PATH=/path/to/rust/checkout/src
export PATH="$PATH:/path/to/racer/binary/"
;; Put in dotspacemacs/user-config
(defun my/use-eslint-from-node-modules ()
(let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
(lambda (dir) (file-executable-p
(expand-file-name "node_modules/.bin/eslint"
dir)))))
(eslint (and root
(expand-file-name "node_modules/.bin/eslint"
root))))