Skip to content

Instantly share code, notes, and snippets.

View jacobsimeon's full-sized avatar

Jacob Morris jacobsimeon

  • Mozilla/Pocket
  • Vancouver, WA
View GitHub Profile
@jacobsimeon
jacobsimeon / manage-services.ps1
Created January 2, 2013 21:44
Manage windows services with powershell.
function StartService($ServiceName, $Computer){
Write-Output "Getting status of $ServiceName on $Computer"
$Service = Get-Service -Name $ServiceName -computername $Computer
if($Service.Status -eq "Running"){
Write-Output "$ServiceName is already running on $Computer"
} else {
Write-Output "Starting $ServiceName on $Computer"
$Service.Start()
}
}
@jacobsimeon
jacobsimeon / .vimrc
Created February 15, 2013 18:11
vimrc
call pathogen#infect()
filetype plugin indent on
"indentation
set tabstop=2 shiftwidth=2 expandtab
set cindent
set smartindent
set autoindent
set nowrap
set number
@jacobsimeon
jacobsimeon / gist:5536709
Created May 7, 2013 22:31
Copy ssh key to authorized_keys on remote server
cat ~/.ssh/id_rsa.pub | ssh user@server "cat >> .ssh/authorized_keys"
@jacobsimeon
jacobsimeon / search_for.rb
Last active December 19, 2015 18:39
Search for (with exclusions)
def search_for(resources, criteria={}, exclusions=nil)
if(criteria[:from])
date = DateTime.parse(criteria.delete(:from))
criteria[:time_utc.gte] = date
end
if criteria[:to]
date = DateTime.parse(criteria.delete(:to))
criteria[:time_utc.lte] = date+1 # lame but we wanted to make the demo
end
<!-- theirs -->
<div class="span6">
<label for="lbl-05">First Name</label>
<div class="txt-holder">
<input type="text" id="inputEmail" placeholder="Email">
</div>
</div>
<!-- bootstrap -->
<div class="control-group">
<%= simple_form_for(
@child,
url: case_children_path(@case)
) do |f| %>
<section>
<header>
<h2>New child</h2>
</header>
<%= f.input :first_name %>
@jacobsimeon
jacobsimeon / error_summary.html.erb
Created August 28, 2013 19:48
displaying an error summary
<%= simple_form_for(@user) do |f| %>
<div class="form-errors">
<% @user.errors.full_messages.each |msg| %>
<div class="error-message">
<%= msg %>
</div>
<% end %>
</div>
<% end %>
<%= simple_form_for(@case) %>
...
<!-- in your fields for one of the spouses -->
<%= f.input :title, collection: User.title_options %>
...
<% end %>
@jacobsimeon
jacobsimeon / custom_plan.rb
Created September 11, 2013 17:29
Add this to root of the projects and name it `custom_plan.rb`
require 'zeus/rails'
require 'dotenv'
class CustomPlan < Zeus::Rails
def boot
Dotenv.load
super
end
end
" highlight trailing whitespace
highlight WhitespaceEOL ctermbg=Red guibg=Red
match WhitespaceEOL /\s\+$/
" remove whitespace before save
autocmd BufWritePre {*.rb,*.js,*.coffee,*.scss,*.haml} :%s/\s\+$//e