Skip to content

Instantly share code, notes, and snippets.

View carpeliam's full-sized avatar
👋
say hi!

Liam Morley carpeliam

👋
say hi!
View GitHub Profile
@carpeliam
carpeliam / gist:08fad4f02e1d3fa2ef23
Last active August 29, 2015 13:58
This is how to get patient summary details from a node console, similar to the function call at https://github.com/robtweed/ewdGateway2/blob/master/ewdLite/node_modules/VistADemo.js#L81.
// after running `vagrant ssh` to log into VM:
// sudo su - osehra
// cd ewdjs
var ewdGlobals = require('ewdjs/lib/ewdGlobals');
var interface = require('nodem/lib/mumps');
var db = new interface.Gtm();
var util = require('util');
var ok = db.open();
ewdGlobals.init(db);
@carpeliam
carpeliam / pre-commit
Last active August 29, 2015 14:06 — forked from eedrummer/pre-commit
#!/bin/sh
#
# To enable this hook, rename this file to "pre-commit".
PRY_PATTERN="require.+[\'\"]pry[\'\"]|binding\.pry"
# Redirect output to stderr.
exec 1>&2
if git diff --cached | grep '^\+' | grep -q -E $PRY_PATTERN; then
echo "ERROR: There is left over pry stuff in this commit"
@carpeliam
carpeliam / SassMeister-input-HTML.html
Last active August 29, 2015 14:14
Basic Bootstrap SASS editor to be used with sassmeister.com's bookmarklet
<link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,400,300,600,700" media="all" rel="stylesheet">
<h1>This is H1 Text</h1>
<h2>This is H2 Text</h2>
<h3>This is H3 Text</h3>
<h4>This is H4 Text</h4>
<h5>This is H5 Text</h5>
<h6>This is H6 Text</h6>
<hr>
@carpeliam
carpeliam / get_prisons.rb
Created January 27, 2015 05:33
Inmate Prison Locator
#!/usr/bin/env ruby
require 'spreadsheet'
require 'capybara'
require 'csv'
include Capybara::DSL
COL_CDCR = 0
@carpeliam
carpeliam / progress_bar.rb
Created July 14, 2015 15:56
Ruby console progress bar
def progress_bar(current, total, width=80)
pos = (current.to_f / total * width).round
print "\r|#{'=' * pos}#{'-' * (width - pos)}|"
puts if current == total
end
<% for i in 1..1000 %>
joe_<%= i %>:
login: joe_<%= i %>
email: joe_<%= i %>@example.com
salt: 356a192b7913b04c54574d18c28d46e6395428ab # SHA1('0')
crypted_password: 6480dd200db2719d431c7a25b133887ad8b46551 # 'monkey'
created_at: <%= 5.days.ago.to_s :db %>
activated_at: <%= 5.days.ago.to_s :db %>
state: active
invitation: <%= Fixtures.identify("#{i}_invite") %>
class Specialty < ActiveRecord::Base
named_scope :all_by_popularity,
:select => 'specialties.*, count(specialties.id) AS c',
:joins => :stores,
:group => 'specialties.id',
:order => 'c DESC'
end
class Group
include DataMapper::Resource
# ... no need to paste everything, right?
has n, :users, :through => Resource
end
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
>> problems.size
=> 99
>> problems.include? "a bitch"
=> false