Skip to content

Instantly share code, notes, and snippets.

View alkalinecoffee's full-sized avatar

Joe Martin alkalinecoffee

  • Comcast
  • Philadelphia, PA
View GitHub Profile
@alkalinecoffee
alkalinecoffee / gist:ffa2c69ef79c1f9f1928
Created March 13, 2015 15:40
(Ruby/Rails) Phone screen/Interview questions
BACKGROUND/PERSONALITY
- Tell me about yourself
- Tell me about what your current project
- What are your responsibilities?
- Describe your workflow (how are requirements/issues submitted and handled?)
- Describe the infrastructure for your current project
- Why were these technologies chosen?
- What is the biggest challenge about your current project?
- Were you able to overcome it? If so, how?
- How many people are on the team?
//bool DEBUG = true;
bool DEBUG = false;
int chans[] = {9, 10, 11, 12};
int relays[] = {5, 6, 7, 8};
int relay;
int chan;
int chan_status;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdjustWindowForFontSizeChange</key>
<true/>
<key>AllowClipboardAccess</key>
<false/>
<key>AnimateDimming</key>
<false/>
@alkalinecoffee
alkalinecoffee / simple_form_bootstrap.rb
Last active November 5, 2015 19:23
custom simple form component
SimpleForm.setup do |config|
config.wrappers :half_width_checkboxes, tag: 'div', class: 'row', error_class: 'has-error' do |b|
b.use :html5
b.wrapper tag: 'div', class: 'col-md-5' do |ba|
ba.wrapper tag: 'div', class: 'panel panel-default' do |bb|
bb.wrapper tag: 'div', class: 'panel-heading' do |bc|
bc.use :h_label, class: 'panel-title'
end
bb.wrapper tag: 'div', class: 'panel-body' do |bc|
@alkalinecoffee
alkalinecoffee / apache_unicorn_whitelist.apacheconf
Last active December 20, 2015 23:39
Apache vhost config for Unicorn with whitelisted IPs
<VirtualHost *:80>
ServerName localhost
# ServerAlias www.localhost.com
DocumentRoot /var/www/myrailsapp/current/public
RewriteEngine On
# Redirect all non-static requests to unicorn
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
@alkalinecoffee
alkalinecoffee / ffi_hba_dll.rb
Last active December 20, 2015 23:39
Using FFI to read from fibre channel HBA dll on a Windows box
require 'ffi'
class Fixnum
def hex(numchars=16)
self.to_s(numchars).upcase
end
end
module FFI
class Struct
@alkalinecoffee
alkalinecoffee / rails_unicorn_initd.sh
Last active December 21, 2015 00:39
An init.d startup script for a Rails app running Unicorn. This setup uses a system-wide Ruby installation and deployments are handled by Capistrano.
#!/bin/bash
# chkconfig: 2345 90 10
# description: init.d script for starting a Rails app running Unicorn.
set -e
USER=rails_deployer
APP_NAME=rails_test
APP_ROOT=/var/www/$APP_NAME
@alkalinecoffee
alkalinecoffee / clean_strings_extension.rb
Created January 24, 2014 22:17
Rails: Clean (strip) all String attributes before saving
# lib/core_ext/active_record_extensions.rb
module ActiveRecordExtensions
extend ActiveSupport::Concern
def clean_strings!
self.attributes.select{|key, val| val.class == String}.each {|key, val| val.strip!}
end
included do
@alkalinecoffee
alkalinecoffee / linux_cheat_sheet.txt
Last active January 21, 2016 01:21
Common linux commands
############
# SYSTEM
############
# show running daemons (CentOS)
systemctl
# show daemon status (CentOS)
systemctl status sshd.service
############
@alkalinecoffee
alkalinecoffee / gist:9081031
Last active September 30, 2016 15:50
Simple Web Requests in PowerShell
# Ignore any SSL certificate errors
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
(New-Object System.Net.WebClient).DownloadFile("http://example.com/myfile.txt", "C:\myfile.txt")