Skip to content

Instantly share code, notes, and snippets.

View joelbrewer's full-sized avatar

Joel Brewer joelbrewer

View GitHub Profile
@joelbrewer
joelbrewer / .vimrc
Created March 23, 2022 22:11
Joel's .vimrc
call plug#begin('~/.vim/bundle')
Plug 'ctrlpvim/ctrlp.vim'
Plug 'pbrisbin/vim-mkdir'
Plug 'thoughtbot/vim-rspec'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-repeat'
Sample document.
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});
@joelbrewer
joelbrewer / gist:a14b7092323537cfd179ff956e4e69f3
Created December 22, 2016 14:36
Running Chromium Headless
xvfb-run -a -e /home/ubuntu/chromium.log -f /home/ubuntu/chromium-tests/xauth -s '-screen 0 1024x768x24' chromium-browser \
--enable-logging=stderr \
--no-first-run \
--ignore-certificate-errors \
--use-fake-ui-for-media-stream \
--use-fake-device-for-media-stream \
--user-data-dir=/home/ubuntu/chromium-tests \
https://example.site.com/#/meeting-test > /home/ubuntu/chromium.log 2>&1
/*
console.log('Hello, world!');
phantom.exit();
*/
var page = require('webpage').create();
var url = 'http://bananarepublic.gap.com/browse/product.do?pid=249853002';
page.open(url);
@joelbrewer
joelbrewer / ListPicker.m
Last active December 18, 2015 17:54
attributedTitleForRow
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
NSString *title = [[self.items objectAtIndex:row] objectForKey:@"text"];
NSString *color = [[self.items objectAtIndex:row] objectForKey:@"color"];
NSAttributedString *attrStr;
if ([ color isEqualToString:@"green"]) {
attrStr = [[NSAttributedString alloc] initWithString:title attributes:@{ NSForegroundColorAttributeName : [UIColor greenColor] }];
} else {
attrStr = [[NSAttributedString alloc] initWithString:title attributes:@{ NSForegroundColorAttributeName : [UIColor blackColor] }];
}
$scope.acceptAppointment = function(currentAppointment) {
var newAppointment = {}
if (userIsAppointmentrealtor() === true) {
newAppointment.confirmed_by_realtor = true;
} else {
newAppointment.status = "confirmed";
}
newAppointment.id = currentAppointment.id;
require 'csv'
require 'json'
require 'set'
require 'pry'
class ProcessLog
def initialize
@mtaids = Set.new []
@data = Hash.new { |hash, key| hash[key] = {"sent": 0, "failed": 0, "successful": 0, "blocking_filters": (Hash.new 0), "blocking_domains": ( Hash.new 0 ) } }
@joelbrewer
joelbrewer / cursing.md
Last active August 29, 2015 14:11
On Cursing

#On Cursing

Last night I had a Twitter conversation that went like this:

Person 1: “The world would be a much better place if people cursed more"

Person 2: “I find that cursing is the easy way out when someone doesn’t know what to say”

Me: “I agree with Person 2. From my experience, cursing tends to alienate and needlessly elevate emotions”

SKU | FINAL_PRICE | CREATED_ON |
----------|-------------|---------------------|
SKU_1 | 700.00 | 2009-07-20 12:07:31 |
SKU_3 | 200.00 | 2009-07-22 12:07:31 |
SKU_7 | 700.00 | 2009-07-25 12:07:31 |
SKU_10 | 900.00 | 2009-07-30 12:07:31 |
SKU_11100 | 10.00 | 2009-07-31 12:07:31 |