Skip to content

Instantly share code, notes, and snippets.

Matt DeBoard mattdeboard

Block or report user

Report or block mattdeboard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mattdeboard
mattdeboard / cycleFrom.js
Created Feb 22, 2019
Cycle through data infinitely. Optionally specify a starting index.
View cycleFrom.js
function* cycleFrom(elements, startIndex = 0) {
let index = startIndex;
while (true) {
if (index >= elements.length) {
index = index % elements.length;
}
yield elements[index];
index += 1;
@mattdeboard
mattdeboard / pull_request_waiter.js
Created Feb 8, 2019
Push PR merge buttons for you
View pull_request_waiter.js
function justClickIt() {
// The web-based minification tools I tried require 'var' instead of 'const'
var mergeButton = document.querySelector(".merge-message .select-menu .btn-group-squash button");
var confirmButton = document.querySelector("button.js-merge-commit-button");
// Selector for the "Update Branch" button
var updateButton = document.querySelector("form.branch-action-btn button");
console.log("Looking for the right buttons...");
if (!!updateButton && !updateButton.disabled) {
@mattdeboard
mattdeboard / camelcase-keys-in-region.el
Created Dec 18, 2018
Convert snake_case JSON keys in region to camelCase
View camelcase-keys-in-region.el
(defun camelcase-keys-in-region (start end)
"Change snake_case JSON keys in the region to camelCase.
START and END are start/end of region."
(interactive "r")
(save-restriction (narrow-to-region start end)
(goto-char (point-min))
(while (re-search-forward "^ *[a-z0-9_]+:" nil t)
(while (re-search-backward "_\\(.\\)" (point-at-bol) t)
(replace-match (upcase (match-string 1)))))))
View main.rs
client.with_framework(
StandardFramework::new()
.configure(|c| c
.owners(owners)
.prefix("~"))
.command("add", |c| c
.cmd(commands::add::add)
// .after(|ctx, msg, error| {
// let data = ctx.data.lock();
// match data.get::<models::draft_pool::DraftPool>() {
View OfferVehicleDrawer.js
<CurrencyInput
editable={editable}
onChange={e =>
handleChange && handleChange(this.props.row.priceCheckParam, e)
}
style={styles.textInput}
value={value}
invalidValueMsg="Must be >= $1,000"
isValueValid={v => v >= 1000}
/>
View .emacs.el
;; With numeric ARG, display the tool bar if and only if ARG is
;; positive. Tool bar has icons document (read file), folder (read
;; directory), X (discard buffer), disk (save), disk+pen (save-as),
;; back arrow (undo), scissors (cut), etc.
(tool-bar-mode 0)
;; Get rid of the annoying splash and startup screens
(setq inhibit-splash-screen t
inhibit-startup-message t)
(setq grep-program "egrep")
(setq-default fill-column 72)
View .emacs.el
;; With numeric ARG, display the tool bar if and only if ARG is
;; positive. Tool bar has icons document (read file), folder (read
;; directory), X (discard buffer), disk (save), disk+pen (save-as),
;; back arrow (undo), scissors (cut), etc.
(tool-bar-mode 0)
;; Get rid of the annoying splash and startup screens
(setq inhibit-splash-screen t
inhibit-startup-message t)
(setq grep-program "egrep")
(setq-default fill-column 72)
@mattdeboard
mattdeboard / it_follows.py
Last active Jan 19, 2017
Simulation of the plot of It Follows
View it_follows.py
#!/usr/bin/env python
import os
import random
class Follower:
def __init__(self, starting_location, current_victim=None):
# `starting_location` is a string representing a file system path.
self.location = starting_location
self.current_victim = current_victim
View it_follows.py
#!/usr/bin/env python
import os
import random
class Follower:
def __init__(self, starting_location, current_victim=None):
# `starting_location` is a string representing a file system path.
self.location = starting_location
self.current_victim = current_victim
@mattdeboard
mattdeboard / .dir-locals.el
Created Jan 9, 2017
This is the right variable to override for jedi in emacs to make Jedi understand where the darn virtualenv lives.
View .dir-locals.el
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((python-mode
(python-shell-virtualenv-path . "/Users/mdeboard/Envs/sumo")))
You can’t perform that action at this time.