Skip to content

Instantly share code, notes, and snippets.

Avatar

Kelli Shaver kellishaver

View GitHub Profile
@kellishaver
kellishaver / thumbnail-preview-demo.html
Created Apr 20, 2012
Demo of how to display cropped thumbnail previews for file input boxes.
View thumbnail-preview-demo.html
<!DOCTYPE html>
<html>
<head>
<title>Image Preview</title>
<script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script>
<style type="text/css">
* {
box-sizing: border-box;
position: relative;
-moz-box-sizing: border-box;
@kellishaver
kellishaver / .rspec
Created Feb 13, 2020
Fun Rspec matcher
View .rspec
# lives in ~/.rspec
# update path to formatter.rb as needed - I also put it in ~/ :)
--require ~/formatter.rb --format GroupingFormatter
@kellishaver
kellishaver / SublimeBlockCursor.py
Created Jun 26, 2012
Sublime Text 2 Block Cursor - outside of Vintage Mode
View SublimeBlockCursor.py
import sublime
import sublime_plugin
class SublimeBlockCursor(sublime_plugin.EventListener):
def view_is_widget(view):
settings = view.settings()
return bool(settings.get('is_widget'))
def show_block_cursor(self, view):
validRegions = []
View clear-sidekiq-jobs.sh
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
# 3. Clear 'Processed' and 'Failed' jobs
@kellishaver
kellishaver / FlappyArmy.ino
Last active Jan 15, 2019
Flappy Guy Army Control Code
View FlappyArmy.ino
#include <IRremote.h>
// FanGates control MOSFET transistors
int FanGates[5] = {3,5,6,9,10};
// Individual states for each Gate (on 1/off 0)
int FanState[5] = {0};
// Array of power levels for each fan
int FanSpeeds[5] = {0};
View song.rb
define :guitar_chords do
in_thread do
4.times do
with_fx :echo, mix: 0.3, phase: 0.25 do
sample :guit_em9, rate: 1
end
sleep 4
end
end
end
View mood_lamp.ino
int pulseSpeed = 5;
int ldrPin = 0;
int redLed = 10;
int greenLed = 11;
int blueLed = 9;
int ambientLight;
int power = 150;
@kellishaver
kellishaver / keymap.c
Created Feb 13, 2016
Planck Custom Keymap
View keymap.c
#include "planck.h"
#define _QW 0
#define _CM 1
#define _DV 2
#define _LW 3
#define _RS 4
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* Qwerty */
@kellishaver
kellishaver / image-analyze.rb
Last active Jan 3, 2016
Analyze an image for the 10 most common colors and their percentage.
View image-analyze.rb
require 'RMagick'
include Magick
puts "Enter the path to the image you wish to analyze:"
file = gets.chomp
image = Magick::ImageList.new(file)
q = image.quantize(10, Magick::RGBColorspace)
palette = q.color_histogram.sort {|a, b| b[1] <=> a[1]}
View gist:8012670
This is my text editor. There are many like it, but this one is mine.
My text editor is my best friend. It is my life. I must master it as I must master my life.
My text editor, without me, is useless. Without my text editor, I am useless. I must use my text editor efficiently.
I must code faster than my approaching deadline which is trying to kill me. I must debug before it arrives. I will...
My text editor and I know that what counts in this project is not the lines of code we write, the automated testing, nor the code linters we use.