Skip to content

Instantly share code, notes, and snippets.

View gabetax's full-sized avatar

Gabe Martin-Dempesy gabetax

  • Zendesk
  • San Francisco
  • 18:12 (UTC -07:00)
View GitHub Profile
@sarciszewski
sarciszewski / wp-api.txt
Created October 29, 2014 00:02
Go Home, WP-API, You're Drunk...
... or more accurately, asleep at the wheel!
_______________________________________________________
_________/ STORY TIME (feel free to skip this if you don't care) \__________
| |
| Recently, I made a quick analysis of all of the public projects listed |
| on HackerOne. https://gist.github.com/sarciszewski/04ee71ad2bcddc9c33b9 |
| |
| If you scroll to the bottom, I listed several projects in the "sweet |
| spot": open source AND a minimum bounty. Outside of the Internet Bug |
| Bounty project, there are only two projects listed: WP-API and Ian Dunn (a |
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@csfrancis
csfrancis / gdb_ruby_backtrace.py
Last active April 24, 2024 05:37
Dump an MRI call stack from gdb
# Updated for Ruby 2.3
string_t = None
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@gabetax
gabetax / rspec-expect-stand-alone-matchers.md
Last active December 20, 2015 16:18
rspec expect-syntax, stand-alone operators, and you

rspec expect syntax and stand-alone operator matches

I recently started a new project using rspec's newer (and soon to be default) expect syntax, and encountered this error:

expect(5).to == 5
ArgumentError: The expect syntax does not support operator matchers, so you must pass a matcher to `#to`

"Why'd they take out operator matches? I've grown quite accustomed to them!", I thought. Digging around, the source of this change started in pull request 119 citing issue 138 as one of the root causes. Here's what's actually happening:

@mganucheau
mganucheau / gist:5499453
Last active December 16, 2015 21:28
LPD8806 LED Code for our Yacht Club's Anchor
// LPD8806 LED Code for our Yacht Club's Anchor
/*************************************************************************************/
#include "LPD8806.h" // Library Here: https://github.com/adafruit/LPD8806
#include "SPI.h"
int totalLEDs = 14;
int dataPin = 2;
int clockPin = 3;
LPD8806 strip = LPD8806(totalLEDs, dataPin, clockPin);
# MAC manipulators
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`'
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE'
@ryanb
ryanb / issues_with_modules.md
Created November 29, 2012 22:38
Points on how modules can make code difficult to read.

My issues with Modules

In researching topics for RailsCasts I often read code in Rails and other gems. This is a great exercise to do. Not only will you pick up some coding tips, but it can help you better understand what makes code readable.

A common practice to organize code in gems is to divide it into modules. When this is done extensively I find it becomes very difficult to read. Before I explain further, a quick detour on instance_eval.

You can find instance_eval used in many DSLs: from routes to state machines. Here's an example from Thinking Sphinx.

class Article &lt; ActiveRecord::Base
@theaboutbox
theaboutbox / .ackrc
Created September 20, 2012 21:49
My .ackrc
--type-add=css=.sass,.less,.scss
--type-add=ruby=.rake,.rsel,.builder,.thor
--type-add=html=.haml,.html.erb,.html.haml
--type-add=js=.js.erb,.coffee
--type-set=cucumber=.feature
--type-set=c=.c,.cpp,.ino,.pde,.h
--ignore-dir=vendor
--ignore-dir=log
--ignore-dir=tmp
--ignore-dir=doc
@pettyjamesm
pettyjamesm / semaphore.rb
Created September 18, 2012 22:40
Ruby Semaphore Implementation
require 'monitor'
class Semaphore
def initialize(maxval = nil)
maxval = maxval.to_i unless maxval.nil?
raise ArgumentError.new("Semaphores must use a positive maximum value or have no maximum!") if maxval and maxval <= 0
@max = maxval || -1
@count = 0
@mon = Monitor.new
@dwait = @mon.new_cond
@uwait = @mon.new_cond