Skip to content

Instantly share code, notes, and snippets.

@brianmario
brianmario / config.ru.rb
Created April 21, 2011 06:11
minimal rails3 app
# minimal rails3 app
require 'action_controller'
Router = ActionDispatch::Routing::RouteSet.new
Router.draw do
root :to => 'site#index'
end
class SiteController < ActionController::Metal
@brianmario
brianmario / utf8_clean.rb
Last active December 9, 2020 20:21
Quick little pure-ruby UTF-8 string verification and cleaning utility
require 'strscan'
module UTF8Util
HIGH_BIT_RANGE = /[\x80-\xff]/n
ENCODING_SUPPORT = "".respond_to?(:force_encoding)
REPLACEMENT = "?"
# Check if this String is valid UTF-8
#
@brianmario
brianmario / bars.md
Last active June 14, 2019 21:29
Some places to check out in Portland

Bars

PROTIP: Bars in Oregon have to serve food as long as they're serving alcohol. As a result, some of them have amazing food.

PROTIP: You can't buy alcohol (other than beer or wine) anywhere else but a state-controlled liquor store. Most of them are closed on Sundays and close around 7pm every other night of the week.

Southeast

  • The Night Light - This was our favorite bar just before we moved to Italy. Right in the heart of the quiet Clinton district (where we were living at the time).
  • The Doug Fir Lounge - I hate to use the word swanky again but that's the only way I can describe it. The entire place is built to look like a log cabin. Used to go here all the time. Pretty good bar. The restaurant is open until 3am (or at least was when I lived there) and has some DAMN good gastro pub style food. The halibut fish and chips and burger are insane. Funny enough, I saw the GitHub guys here (including maddox and Tek I think?) after
-----BEGIN PGP MESSAGE-----
owEBfQKC/ZANAwAIAUm7GEcBH5sfAcs2YgBac2jmb21nIGFyZSB5b3UgYnJpYW5t
YXJpbyBjYW4geW91IHNpZ24gbXkgY29tbWl0Pz8/iQIzBAABCAAdFiEETMN8nLT+
2BDZVvUSSbsYRwEfmx8FAlpzaOYACgkQSbsYRwEfmx9hOQ/+L6VTP8XUw8I/DjHQ
y8MU5J11bd7VE3OwnZiapLpWHsMTF25nJgorCP2Fo/vcC6XH5KunrlqLCm2dqcdm
nYEyjxb/Ty8zPMB+YlGGZLfL+DRcjjCHhkE3zXWBOiMOw/hvNoe5vu5MuHkfcJaO
wkZJBVXWIJen2E4gW8+1go/s4Jeu4HsCWKOln5i7dNsXdI0uQS9YsVYfmhFPVeyE
xJtAawJRV+c7hRIG7IYs14ZLhvglGBo03BUBBJLloIJu1X4/Ivr6ocAXOLz5LYIQ
qKeo/hDdwzw1a8JWmBuID67W61zvh7YbJunIuSH5/BXMFXIt0EzZLr2qw1xTbdei
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <yajl/yajl_gen.h>
#include <yajl/yajl_parse.h>
static int yajl_found_null(void* ctx) {
(void)ctx;
fprintf(stdout, "yajl_found_null\n");

Amsterdam Recos

If you are looking to get high, download the app "Greenmile" to find coffeeshops and smartshops near you! (only available on Android) Also, Boerejongens Coffeeshop is legit.

Jordaan

To Do:

  • Anne Frank Museum: tour of her house, always a huge line so book in advance and go on a weekday if you can.
diff --git a/ext/memcached/memcached.c b/ext/memcached/memcached.c
index e4a0449..cec0731 100644
--- a/ext/memcached/memcached.c
+++ b/ext/memcached/memcached.c
@@ -197,6 +197,62 @@ rb_connection_set(VALUE self, VALUE rb_key, VALUE rb_value, VALUE rb_ttl, VALUE
}
static VALUE
+rb_connection_set_multi(VALUE self, VALUE rb_values)
+{

Keybase proof

I hereby claim:

  • I am brianmario on github.
  • I am brianmario (https://keybase.io/brianmario) on keybase.
  • I have a public key whose fingerprint is DBE5 F35D 2FA6 6D3F A0E0 831F 27DB 14DD 6387 BC0E

To claim this, I am signing this object:

@brianmario
brianmario / detector.go
Created November 19, 2013 09:40
A simple binary and text encoding detector wrapping libicu's encoding detection API
package main
/*
#cgo CFLAGS: -I/opt/boxen/homebrew/opt/icu4c/include
#cgo LDFLAGS: -L/opt/boxen/homebrew/opt/icu4c/lib -licui18n -licuuc
#include <stdlib.h>
#include <unicode/ucsdet.h>
*/
import "C"
#include <stdlib.h>
#include <string.h>
#include <mysql.h>
int main() {
MYSQL *client;
MYSQL_RES *result;
int err;
char *query = "SELECT 1";