Keybase proof
I hereby claim:
- I am eric1234 on github.
- I am ericanderson (https://keybase.io/ericanderson) on keybase.
- I have a public key ASAzwRnO3uw3H6ISre5d7qPiagNyP3Txxa85qdoCl4lk1Ao
To claim this, I am signing this object:
--- ext/openssl/ossl_pkey_ec.c 2010-06-21 04:18:59.000000000 -0500 | |
+++ ext/openssl/ossl_pkey_ec.c 2013-12-10 13:30:18.919963527 -0600 | |
@@ -757,8 +757,10 @@ | |
method = EC_GFp_mont_method(); | |
} else if (id == s_GFp_nist) { | |
method = EC_GFp_nist_method(); | |
+ #if !defined(OPENSSL_NO_EC2M) | |
} else if (id == s_GF2m_simple) { | |
method = EC_GF2m_simple_method(); | |
+ #endif |
class WidgetsController < ApplicationController | |
let(:widgets) { Widget.all } | |
let(:widget) { widgets.find_or_initialize_by id: params[:id] } | |
def new | |
render :form | |
end | |
def edit | |
render :form |
I hereby claim:
To claim this, I am signing this object:
$url = 'http://some.url/file.txt';
$data = download($url, $headers, $err_msg);
if( !$data ) {
echo $err_msg;
die;
}
class WidgetsController < ApplicationController | |
before_action :set_widget, only: [:show, :edit, :update, :destroy] | |
# GET /widgets | |
def index | |
@widgets = Widget.all | |
end | |
# GET /widgets/1 | |
def show |
module MultiDef | |
def defs *names, &blk | |
names.each { |name| define_method name, blk } | |
end | |
end |
module Lettable | |
def let name, &blk | |
iv = "@#{name}" | |
define_method name do | |
return instance_variable_get iv if instance_variable_defined? iv | |
instance_variable_set iv, instance_eval(&blk) | |
end | |
helper_method name |
class Admin::AgentsController < AdminController | |
include ListParams | |
include StatusFilter | |
helper :filter | |
let(:agents) { policy_scope authorize Agent.all } | |
let(:agent) { authorize agents.with_stats.find_or_build params[:id] } | |
def index |
{ | |
"name": { | |
"first": "Eric", | |
"last": "Anderson" | |
}, | |
"title": ["Owner", "Programmer"], | |
"email": "eric@pixelwareinc.com", | |
"phone": "404-290-8411", | |
"company": { | |
"name": "Pixelware, LLC", |
Sometimes I want to extend a core object to keep things object oriented but I want to limit the scope of my extension. Refinements provide a nice solution to that but for a single method extension I find it a bit bulky. Here is some standard syntax:
class SomeObject
module Extension
refine Array do
def average