Skip to content

Instantly share code, notes, and snippets.

View armw4's full-sized avatar
🎯
Focusing

Antwan R. Wimberly armw4

🎯
Focusing
  • Stay tuned...
  • Atlanta, GA, USA
View GitHub Profile
@armw4
armw4 / md5-sha44-sha256-sha384-sha512-python.md
Last active December 31, 2015 18:29
OpenSsl can lead to weird problems with python, brew, and Mac OS X. It all boils down to making sure openssl is pointing to brew's version of openssl, as opposed to your system's version (the default that ships with your OS).

###by Antwan Wimberly###

➜ ~ pip ERROR:root:code for hash md5 was not found. Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 139, in globals()[__func_name] = __get_hash(__func_name) File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 91, in __get_builtin_constructor raise ValueError('unsupported hash type ' + name) ValueError: unsupported hash type md5

@armw4
armw4 / Web.config
Last active December 31, 2015 19:19
An experiment with nokogiri. Provides a DSL for ad-hoc element generation similar to how Nokogiri::XML::Builder works. In a separate experiment, I plan to allow composition with builders. You'll be able to heterogeneously mix the builder API with my API.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings />
</configuration>
@armw4
armw4 / dollarz.rb
Last active January 3, 2016 15:59
Well...I've got quite a few nicknames for my dear friend D$...I meant Dollarz...I meant D Dollarz...I meant Danny...uh...yea
DANNY_ALIASES = ["Danny", "D$", "Dollarz", "D Dollarz"]
DANNY_ALIASES.each do |item|
def item.eql? (other)
DANNY_ALIASES.include? other and DANNY_ALIASES.include? self
end
end
DANNY_ALIASES.each_with_index do |item, index|
if next_item = DANNY_ALIASES[index + 1]
@armw4
armw4 / dollarz.js
Last active January 3, 2016 15:59
Well...he wasn't satisfied...wanted to see it in JavaScript...sigh
var DANNY_ALIASES = ['Danny', 'D$', 'Dollarz', 'D Dollarz'];
// hwa? why isn't he using underscore or loadash? #STFUUUUUUU!!!!!
DANNY_ALIASES.include = function(item) {
var include = false;
for(var i = 0; i < this.length; i++) {
if (this[i] == item) {
include = true;
break;
@armw4
armw4 / override-inherited-method-ad-hoc-block.rb
Created January 24, 2014 20:13
I wanted to know if you could arbitrarily pass a block to an overridden method via "super". It seems like an obvious "yes", but my curiosity got the better of me once more. Normally you call "super" with no arguments. Don't recall ever seeing it invoked with a block. So there you have it...
class Base
def deploy(&block)
puts "work"
yield if block_given?
puts "done working"
end
end
class Derived < Base
def deploy
@armw4
armw4 / ruby-array-truthiness.rb
Created January 25, 2014 23:12
Don't sleep on arrays. When looking for a "truthy" value, you need to ensure the array has been initialized (not nil), AND also that it's length is a positive integer.
my_array = []
puts "It's alive" if my_array # truthy...empty array does not return false
puts "It's alive" if my_array.length # truthy again....0 does not return false
# the ultimate truthy test for arrays...finally we get back false..hence no output
puts "It's alive" if my_array && my_array.length > 0
@armw4
armw4 / grunt-karma-background-suppresses-errors.md
Last active January 4, 2016 14:49
BEWARE: Using the background key in your grunt-karma (as of v0.6.2) config will suppress any runtime errors.

###by Antwan Wimberly###

I had this config setup (remainder of config left out for brevity...am using grunt-contrib-watch just like in the README):

module.exports = (grunt) ->
  grunt.initConfig
    pkg: grunt.file.readJSON 'package.json'
    karma:
 unit:
@armw4
armw4 / .tmux.conf
Last active January 4, 2016 16:59
My tmux.config file that I've pieced together based on others.
# status bar
set-option -g status-utf8 on
### COLOUR (Solarized dark)
# default statusbar colors
set-option -g status-bg black #base02
set-option -g status-fg yellow #yellow
set-option -g status-attr default
@armw4
armw4 / alias_dynamically_created_method.rb
Last active January 4, 2016 20:29
Was curious as to how I could go about implementing this. Alias a method after dynamically defining it. You have to use 'send' here since 'alias_method' is private. Cheers!!
Fixnum.class_eval %Q{
def blank_man
"blank man"
end
}
Fixnum.send :alias_method, :blank_man_new, :blank_man
puts "they're equal" if 14.blank_man == 14.blank_man_new # => they're equal
@armw4
armw4 / npm.md
Last active February 21, 2016 06:51
It's all about the last published date

Why?

Why...why are we here good sir? Well...I don't want to be here right now. I really don't. It's Saturday night, the Warriors beat the Clippers by the hair on the chinnies and dodged a late fourth quarter comeback, and I really want to eat. But...I have to blog. I have to do it now. If I don't, this story will not be the same. Why are we here? Because I'm on production support, that's why. I got an email from pagerduty that was like:

Unhandled rejection TypeError: next is not a function

I'm like huh? Wtf. What broke now? Why now? It's the weekend, I don't want to be here. I want to do me!!!!! But...I'm on production