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 / 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 / array-constructor-new-with-block.md
Last active August 29, 2015 13:56
A bit of syntactic sugar the Array contructor exposes to create a fixed number of instances.

by Antwan Wimberly

I was not aware this was possible until I came across this post looking for examples of using ActiveRecord and rspec in unison.

I frequently make use of sample data in my posts; most commonly in the form of arrays.

In the midst of "shooting the breeze" with my fellow companions on the awesome "programmer files" gist, I could have made use of:

Array.new(3) { Person.new }
@armw4
armw4 / shell-history-trickshot.md
Last active August 29, 2015 13:56
A handy bash/zsh/shell trick shot I picked up a few weeks back.

by Antwan Wimberly

I'm a huge fan and heavy user of Vim (I do all my ruby and open source development there...anything that' not Microsoft basically). I happen to use what I like to refer to as a "Vim bootstrap" in Steve Francia's awesome spf13.

It has sane defaults and comes equipped with the latest and greatest Vim plugins on the market.

After installing the bootstrap, you'll want to ensure you keep it update to date just like Homebrew formulas, ruby gems, and npm packages. It's prett easy to upgrade your bootstrap, but who really has enough RAM in their brain to store that curl command? Sure you could drop it into a script, make it executable via chmod, and put it into some folder that's attached to your $PATH variable, but I've yet to cross that bridge. I do know however that I've executed that command numerous times and that it should be stashed somewhere in my zsh history. I know it contains the string "curl", so I whip

@armw4
armw4 / file.join.md
Last active August 29, 2015 13:56
What happens when you invoke File.join with variable arguments?

by Antwan Wimberly

I finally figured it out (probably could have just ready the documentation, but who has time for that when they're gluttonously binging on source code)?

"You're eating right now, aren't you? You disgust us..."

It's just a platform independant way of creating a path. It's abstracting the proper separator for you (which is either a backslash or forward flash depending on whether or not you're on *nix or Windows). It's even smart enough to not add a slash to the path if any of your arguments already contain it.

File.join("hi-there/now", 'locales', '*.yml') # => "hi-there/now/locales/*.yml"
@armw4
armw4 / yank-copy-paste-not-working-tmux-vim.md
Last active October 8, 2016 13:51
Yank not working in Vim/MacVim.

by Antwan Wimberly

I recently encountered issues with yanking text in Vim. Yup, you know it, the infamous

***E353: Nothing in register ****

Only problem was, I wasn't sure if the issue was MacVim or spf13. Before logging an issue in either project, I decided to do a little research in hopes that someone had encountered a similar problem in the past. Luckily I can across this article by googling

macvim cant yank text

@armw4
armw4 / before-after-all-helper.coffee
Last active August 29, 2015 13:56
jasmine_node beforeAll afterAll helper
# monkey patches jasmine (node) to provide beforeAll and afterAll hooks
#
# be sure to add this file as a helper as described in my answer on SO:
#
# http://stackoverflow.com/a/22054113/389103
#
# inspired by https://groups.google.com/forum/#!msg/jasmine-js/1LvuiUPunwU/SXPo6PMGSSMJ
#
# targets jasmine-node@1.13.1 and jasmine@1.3.1
#
@armw4
armw4 / karma.md
Last active January 9, 2020 19:45
Having no specs is an error in karma.

by Antwan Wimberly

So I'm setting up my first project using gulp, karma, and jasminejs. I setup my karma task, and after repeatedly banging my head against my desk, I finally managed to get everything properly configured....or so I thought. It seemed like all the errors and warnings I'd encountered had been resovled (and they were). But for some reason, when I ran the task, I kept getting this output:

[13:03:58] Starting 'clean'...
[13:03:58] Finished 'clean' after 3.28 ms
[13:03:58] Starting 'files:scripts'...
[13:03:58] Starting 'files:specs'...
[13:03:58] Finished 'files:scripts' after 37 ms
@armw4
armw4 / $httpBackend-url-matcher-builder.coffee
Last active August 29, 2015 14:15
Naive regex builder that helps henerate url matchers for $httpBackend based on routing syntax.
# https://docs.angularjs.org/api/ngMockE2E/service/$httpBackend
### @usage
path = require './path'
urlMatcher = path '/users/:guid/helloworld/:guid'
phones = [{name: 'phone1'}, {name: 'phone2'}]
$httpBackend.whenGET(urlMatcher).respond(phones)