Skip to content

Instantly share code, notes, and snippets.

View thrashr888's full-sized avatar
🐮
moo

Paul Thrasher thrashr888

🐮
moo
View GitHub Profile
// respond to key events
Game.Player.prototype.keyUp = function (e) {
delete this._keysPressed[e.key];
};
// respond to key events
Game.Player.prototype.keyDown = function (e) {
this._keysPressed[e.key] = true;
@thrashr888
thrashr888 / cache.php
Last active March 24, 2018 03:32
php file cache example
<?php
function get_cache($key) {
$cacheFolder = '/tmp/wp-site/';
$cacheFile = $cacheFolder+$key
if(file_exists($cacheFile) {
$contents = file_read($cacheFile);
return json_decode($contents);
} else {
return false;
@thrashr888
thrashr888 / recursive-fetch.js
Last active March 24, 2018 03:32
recursive fetch for wordpress API
let lastPage = 25;
let self = this;
function getPage(thisPage) {
console.log('Loading page', thisPage);
fetch(self.state.url + '&page=' + thisPage)
.then(response => {
if (response.headers.has('X-WP-TotalPages')) {
lastPage = response.headers.get('X-WP-TotalPages');
}
return response.json();
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "O", function()
hs.notify.new({title="Hammerspoon", informativeText="Hello World"}):send()
end)
-- Move window up
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function()
local win = hs.window.focusedWindow()
local f = win:frame()
function cpu_load() {
ps -A -o %cpu | awk '{s+=$1} END {print s "%"}'
}
function battery_load() {
pmset -g batt | grep -o '[0-9]*%' | tr -d %
}
export PS1='`if [ $? = 0 ]; then echo "\[\033[01;32m\]✔"; else echo "\[\033[01;31m\]✘"; fi` \[\033[01;37m\]\u\[\033[01;36m\] \[\033[01;33m\]\t \[\033[01;37m\]($(cpu_load)) [\[\033[01;33m\]$(battery_load)⚡\[\033[01;37m\]] \[\033[01;36m\]\W\[\033[35m\]$(__git_ps1 " %s") \[\033[01;37m\]⚡\[\033[00m\] '
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/tmp": true,
"**/yarn_cache": true
// "**/env": true
},
<link rel="import" href="../code-mirror/code-mirror.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../cool-clock/cool-clock.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-drawer-panel/core-drawer-panel.html">
<polymer-element name="my-element">
<template>

Keybase proof

I hereby claim:

  • I am thrashr888 on github.
  • I am thrashr888 (https://keybase.io/thrashr888) on keybase.
  • I have a public key whose fingerprint is 9727 431B 6A11 3C81 5C36 0AAD EFBE 5242 69DA 1410

To claim this, I am signing this object:

@thrashr888
thrashr888 / mlk-biography.html
Last active August 29, 2015 13:57
MLK biography
<section class="m-person--facts">
<h1>Quick Facts</h1>
<dl>
<dt>Name</dt>
<dd itemprop="name">Martin Luther King Jr.</dd>
<dt>Occupation</dt>
<dd><a href="/people/occupation/civil-rights-activist">Civil Rights Activist</a>,
<a href="/people/occupation/minister">Minister</a></dd>
# install dependencies
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm
# clone cpuminer
git clone https://github.com/pooler/cpuminer.git
# compile
cd cpuminer
./autogen.sh
./configure CFLAGS="-O3"