Skip to content

Instantly share code, notes, and snippets.

View brettinternet's full-sized avatar
👋

Brett brettinternet

👋
View GitHub Profile
@brettinternet
brettinternet / package.json
Created January 1, 2021 00:54 — forked from mnpenner/package.json
Rollup Plugin: Pug
{
"license": "UNLICENSED",
"dependencies": {
"fastify": "^3.9.2",
"fastify-cookie": "^5.1.0",
"fastify-sensible": "^3.1.0",
"google-auth-library": "^6.1.3",
"lodash": "^4.17.20",
"pug": "^3.0.0",
"pug-runtime": "^3.0.0"
@brettinternet
brettinternet / ReactBindingApproaches.js
Created January 26, 2018 16:42 — forked from coryhouse/ReactBindingApproaches.js
React Binding Approaches
// Approach 1: Use React.createClass
var HelloWorld = React.createClass({
getInitialState() {
return { message: 'Hi' };
},
logMessage() {
// this magically works because React.createClass autobinds.
console.log(this.state.message);
},
@brettinternet
brettinternet / time_del.py
Last active July 10, 2017 20:58 — forked from mattieb/time_del.py
Time various methods of removing a possibly-present item from a dict
#!/usr/bin/python3
import time
def new_d():
return {
1: 2, 3: 4, 5: 6, 7: 8, 9: 10,
11: 12, 13: 14, 15: 16, 17: 18, 19: 20
}
@brettinternet
brettinternet / notepad.html
Created March 15, 2017 21:01 — forked from jdkanani/notepad.html
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
<!--
For other language: Instead of `ace/mode/ruby`, Use
Markdown -> `ace/mode/markdown`
Python -> `ace/mode/python`
C/C++ -> `ace/mode/c_cpp`
Javscript -> `ace/mode/javascript`
Java -> `ace/mode/java`
Scala- -> `ace/mode/scala`
@brettinternet
brettinternet / sudo-keepalive-example.sh
Created March 8, 2017 06:46 — forked from cowboy/sudo-keepalive-example.sh
Bash: Sudo keep-alive (good for long-running scripts that need sudo internally but shouldn't be run with sudo)
#!/bin/bash
# Might as well ask for password up-front, right?
sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Example: do stuff over the next 30+ mins that requires sudo here or there.
function wait() {
@brettinternet
brettinternet / tmux-cheatsheet.markdown
Created March 3, 2017 02:05 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@brettinternet
brettinternet / now_playing.osascript
Created February 25, 2017 08:23 — forked from JorenSix/now_playing.osascript
This osascript gets and returns the meta data of the track that is currently playing in Spotify on Mac OS X.
#!/usr/bin/osascript
#
# now_playing.osascript
#
# Osascript to fetch the meta data of the currently playing
# track in Spotify. This works only on Mac OS X.
tell application "System Events"
set myList to (name of every process)
end tell
@namespace html url(http://www.w3.org/1999/xhtml);
@namespace xul url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
/*
Author: Twily
Description: Minimal flat styled tabs for Australis
Compitability: Firefox Nightly v31.0a1 - v32.0a1 (Australis)
CSS Variables were introduced to Firefox in v29.0a1
Website: http://twily.info/
*/