Skip to content

Instantly share code, notes, and snippets.

View gabetax's full-sized avatar

Gabe Martin-Dempesy gabetax

  • Zendesk
  • San Francisco
  • 18:39 (UTC -07:00)
View GitHub Profile
@raggi
raggi / roflscale.txt
Created November 3, 2010 02:05
sekrets of the roflscale sauce
08:58 Defi_: can anyone tell me if there are any obvious disadvantages to patching a blocking library to use fibers at the socket level?
08:58 Defi_: its far too much effort to have to rewrite large chunks of every library just to make it async and fiber-aware
08:59 raggi: if it uses non-stack stored state you could end up with concurrency issues (read: race conditions)
08:59 raggi: fibers as implemented in MRI have limited size stacks (4kb)
09:00 Defi_: hmm alright :/
09:01 raggi: if the library is trying to be thread safe, it can make a real mess too
09:01 raggi: Defi_: just use threads.
09:02 Defi_: raggi: not gonna happen...
09:02 Defi_: even if this was a personal project, i wouldnt use threads
09:03 Defi_: guess ill just have to continue rewriting parts of a bunch of libs as i go
@jcf
jcf / email_validator.rb
Created September 2, 2011 10:48 — forked from stauntonknight/email_validator.rb
Rails 3 Email Validator
require 'mail'
class EmailValidator < ActiveModel::EachValidator
attr_reader :record, :attribute, :value, :email, :tree
def validate_each(record, attribute, value)
@record, @attribute, @value = record, attribute, value
@email = Mail::Address.new(value)
@tree = email.__send__(:tree)
@austinhappel
austinhappel / Monokai-AH.tmTheme
Created June 6, 2012 05:13
Sublime Text 2 Mononkai theme that supports MarkDown
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@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);
@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:

@gabetax
gabetax / json_pluck.rb
Last active February 1, 2016 18:45
Pluck values out of JSON logs
#!/usr/bin/env ruby
require 'json'
# Usage:
# head production.log.json | ruby json_pluck.rb time,session,message
# colorize output when going to stdout or if explicitly requested (e.g. `| less -r`)
color = $stdout.tty?
color = true if ARGV.first == '-c' && ARGV.shift
@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 |
@kagemusha
kagemusha / gist:1504625
Created December 21, 2011 04:43
Invalidate Session when SessionRestoreError in Rails 3.x
Tested on: Rails 3.1
If have error:
ActionDispatch::Session::SessionRestoreError (Session contains objects whose class definition isn't available.
Remember to require the classes for all objects kept in the session.
can fix by changing a char in secret token in initializers/secret_token.rb
MyApp::Application.config.secret_token
@miogalang
miogalang / Restaurants.md
Last active April 27, 2019 13:38
Manila Restaurants

Food


In Fort Bonifacio


  • Sarsa
    • Type of Cuisine: Filipino
    • What to order:
@jbarnette
jbarnette / stupid.rb
Created March 22, 2012 15:57
Incredibly stupid Ruby tricks. Please add more.
# The worst possible way to memoize something.
class X
def value
@value = really_expensive_operation
def value; @value end
@value
end
end