Skip to content

Instantly share code, notes, and snippets.

View mustmodify's full-sized avatar

Johnathon "jw" Wright mustmodify

View GitHub Profile
production@ec2-server: time bin/rails c
exit ( typed while waiting for it to load )
Loading development environment (Rails 4.0.2)
irb(main):001:0> exit
real 0m11.141s
user 0m19.918s
sys 0m0.983s
@mustmodify
mustmodify / gist:40611a252f8bfbf9ab47
Last active January 26, 2018 21:08
ruby + nginx + puma
brand new slice as root:
One of these...
echo "America/New_York" > /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
or
sudo timedatectl set-timezone America/New_York
so...he has a branch. his branch has a local and a remote...he was local...and committed several times...then b/c when he pushed it said he couldn't b/c the origin of his branch was behind...because i merged the master into his origin branch so he could have all the updates, but he never pulled them
and continued to change his local branch...so his local branch and origin branch were so out of sync they couldn't resolve themselves...so i made him pull the remote of his branch (origin)...which apparently overwrote all of the local commits he had been doing all week
then he committed the local branch to get it in sync then pushed to the origin of his branch to make everything even again
...now...all those local commits that were overwritten are gone
@mustmodify
mustmodify / gist:fdc8cc85ae84b85f65c9
Created August 22, 2014 14:30
collection+embedded+JSON
collection:
{
embedded:
[
{
collection:
{
href: '/stuff/123.json',
items:
[
@mustmodify
mustmodify / 1_the_spec
Created August 22, 2014 15:16
something wacky this way comes
it 'searches by zipcode' do
puts "Before this bruhaha, zipcode count is #{Zipcode.count}: #{Zipcode.all.map(&:code)}"
needle = Zipcode.where(:code => '90333').first || FactoryGirl.create(:zipcode, code: '90333')
puts "in the middle, zipcode count is #{Zipcode.count}: #{Zipcode.all.map(&:code)}"
get :search, :format => :json, :code => 90333
assigns(:zipcodes).should have(1).entry
assigns(:zipcodes).should include(needle)
/* from item-level link */
{
"collection": {
"href": "/characters.json",
"embedded": [
{
"collection": {
"href": "/characters/the_doctor/actors.json",
"items": [
jw@logopolis:/projects/medycation/api$ curl http://api.server.com:9292/index.json -I -H 'Accept-Encoding: gzip, deflate'
HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-UA-Compatible: chrome=1
Content-Type: application/json; charset=utf-8
ETag: "34ac3eee261d4ffa245819f3c20387bd"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=HEAD; path=/
select count(DISTINCT(appointments.id)) from appointments LEFT JOIN pictures ON pictures.appointment_id = appointments.id LEFT JOIN routes ON appointments.route_id = routes.id WHERE pictures.created_at IS NOT NULL AND DATE(CONVERT_TZ(MIN(pictures.created_at), 'UTC', 'US/Eastern')) != routes.date GROUP BY appointments.id;
class UserSearch < Valuable
has_value :term
has_value :include_inactive, :default => false
has_value :postal_code
def scope
User.apply( conditions )
end
def term_like
#! /bin/bash
export HOME=/home/jw
export RAILS_ENV=development
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
# there is a .ruby-version under /projects/client/project but I've tried setting it here, too.