Skip to content

Instantly share code, notes, and snippets.

Indivisible Tech Committee Meeting - Feb. 16, 2016

Objectives

  1. Commit to our first deliverable(s).
  2. Bulleten Board / Forum
  3. Calendar / Scheduling Solution
  4. Public Website
  5. Hosting (aka Security part 1)
  6. How, and with whom, should we host?
class Applicant
def recent_rejection_reasons
rejection_reasons.where("rejection_reasons.created_at > '#{longest_days_ago}'")
end
end
class RejectionReason
def recently_rejected?
recency_cutoff = RejectionReason::REJECTION_REASON_CODES[reason_code][:days_blocked].days.ago
created_at > recency_cutoff
@bencates
bencates / .vimrc
Created July 23, 2015 22:07
vimrc
" Use Vim extensions; must be first thing in file
set nocompatible
" Use a POSIX compliant shell
set shell=/bin/bash
" BEGIN Vundle setup
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
  1. What frameworks or libraries do you generally pull in when starting a fresh PHP project? Why do you use them?

    My only must have is either phpspec or PHPUnit. I prefer phpspec, but it makes rather opinionated assumptions about project structure, so PHPUnit is much easier to set up on older projects.

    Beyond that, I've had good luck with both Silex and Twig. They're both simple, focused libraries to provide the Controller and View components, respecitvely, of a MVC framework.

    To be honest, though, most of my fresh projects aren't in PHP. I prefer either Ruby or NodeJS when given the choice. Most of my experience with PHP has been picking up existing projects and using whatever framework and tools already exist on them.

  2. If I told you that we needed to use a third party API to get some arbitrary data, would you prefer XML or JSON? Why?

@bencates
bencates / svgtest.html
Created June 26, 2014 04:43
Draw a SVG hexagonal grid
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>SVG Test</title>
</head>
<body>
<svg id="s" version="1.1"
width="300" height="300"
xmlns="http://www.w3.org/2000/svg">
@bencates
bencates / jekyll_pretty_urls.rb
Created March 7, 2014 22:32
Simple Jekyll plugin to convert files into directories with indexes.
module PrettyUrls
class Generator < Jekyll::Generator
def generate(site)
site.pages.each do |page|
if page.name.split('/').last !~ /^index.\w+$/
page.data['permalink'] ||= page.name.gsub(/\.\w+$/, '/index.html')
end
end
end
end
@bencates
bencates / rails.cap
Last active December 27, 2015 00:19
Capistrano 3 rails console commands
class TTYBackend < SSHKit::Backend::Printer
def execute(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
command(*args).tap do |cmd|
output << cmd
cmd.started = Time.now
system %Q{ssh -l #{@host.user} #{@host.hostname} -t "#{cmd.to_command}"}
@bencates
bencates / navbar_helper
Created July 26, 2013 21:46
Various methods of adding the 'active' class to a nav menu item
module NavbarHelper
# based on url path
def nav_menu_link_1(name, url)
active = request.path.starts_with?(url)
content_tag :li, class: active ? 'active' : nil do
link_to name, url
end
end
# based on controller
@bencates
bencates / thin
Last active December 20, 2015 02:19 — forked from sorah/thin
#!/bin/bash
CURRENT_DIR=/home/
DAEMON=$CURRENT_DIR/bin/thin
CONFIG=$CURRENT_DIR/config/thin.yml
SCRIPT_NAME=/etc/init.d/thin
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
@bencates
bencates / basetup
Created September 19, 2011 19:40
Blue Acorn staging site setup script
#!/usr/bin/env bash
###
# Blue Acorn staging site setup script
# v0.1
# by Ben Cates
###
domain='local'
server='mamp'