Skip to content

Instantly share code, notes, and snippets.

View wnstn's full-sized avatar

Winston Hearn wnstn

View GitHub Profile
@wnstn
wnstn / split_names.rb
Created September 14, 2012 19:44
patient_migration
def up
patients = Patient.find(:all)
patients.each do |patient|
full_name = patient.name.split
patient.update_attributes(first_name: full_name[0], last_name: full_name[1])
end
end
def down
if full_name.size == 3
patient.update_attributes(first_name: full_name[0,1], last_name: full_name[2])
else
patient.update_attributes(first_name: full_name[0], last_name: full_name[1])
end
@wnstn
wnstn / social.html
Last active December 10, 2015 19:58
markup for social
<div class="social-media">
<p>Connect with Vaco:</p>
<p class="social-icon"><a class="twitter" title="Vaco twitter home page" href="http://twitter.com/vaco_raleigh" target="_blank"><img style="float: left;" src="http://i1017.photobucket.com/albums/af294/tknight2112/Twitter.png" alt="Twitter" width="63" height="63" /></a></p>
<p class="social-icon"><a class="linked-in" title="Vaco linkedIn home page" href="http://www.linkedin.com/companies/vaco" target="_blank"><img style="float: left;" src="http://i1017.photobucket.com/albums/af294/tknight2112/LinkedIn_gradient.png" alt="linkedIn" width="63" height="63" /></a></p>
<p class="social-icon"><a class="facebook" title="Vaco facebook home page" href="http://www.facebook.com/pages/Raleigh-NC/Vaco-Raleigh/179980064366" target="_blank"><img style="float: left;" src="http://i1017.photobucket.com/albums/af294/tknight2112/Facebook.png" alt="facebook" width="63" height="63" /></a></p>
<p class="social-icon"><a class="blog" title="Vaco Blogging home page" href="http://vacor
@wnstn
wnstn / rake-error-output.rb
Created January 8, 2013 20:26
rake error
PG::Error: ERROR: relation "facilities" does not exist
LINE 5: WHERE a.attrelid = '"facilities"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"facilities"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
NoMethodError in Manage/progress_reports#index
Showing /Users/CS_Spare/.rvm/gems/ruby-1.9.3-p125@carecom/gems/datagrid-0.6.2/app/views/datagrid/_row.html.erb where line #3 raised:
undefined method `name' for #<Patient:0x007ffbadc912a0>
Extracted source (around line #3):
1: <tr class="<%= options[:cycle] && cycle(*options[:cycle]) %>">
2: <% grid.columns.each do |column| %>
3: <td class="<%= datagrid_column_classes(grid, column) %>"><%= datagrid_format_value(grid, column, asset) %></td>
@wnstn
wnstn / csextra.module
Last active December 10, 2015 22:38
Module temp
<?php
function csextra_block($op = 'list', $delta = 0, $edit = array())
{
switch ($op) {
case 'list':
$blocks[0]['info'] = t('Send To a Friend Form');
$blocks[1]['info'] = t('Sign Up for Our Newsletter');
$blocks[2]['info'] = t('Event Ticket Button`');
return $blocks;
@wnstn
wnstn / feed.coffee
Last active December 11, 2015 02:28
PubSub method using coffeescript classes and jquery's callbacks
class @Feed
constructor: (@func)->
@callbacks = $.Callbacks()
init: ->
@subscribe( @func )
subscribe: =>
@callbacks.add( @func )
publish: (args)=>
if args.length < 1
@callbacks.fire @func
@wnstn
wnstn / router.php
Created April 16, 2013 14:27
Wordpress router.php, for using the built in PHP server with WP sites.
<?php
$root = $_SERVER['DOCUMENT_ROOT'];
chdir($root);
$path = '/'.ltrim(parse_url($_SERVER['REQUEST_URI'])['path'],'/');
if(file_exists($root.$path))
{
if(is_dir($root.$path) && substr($path,strlen($path) - 1, 1) !== '/')
{
header('location: '.rtrim($path,'/').'/');
/etc /usr/local/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log [ruby-1.9.3-p125]
FATAL: could not create shared memory segment: Invalid argument
DETAIL: Failed system call was shmget(key=5432001, size=14442496, 03600).
HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 14442496 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.
@wnstn
wnstn / beautiful.scss
Last active December 19, 2015 06:29
I love you Sass
.feed-section-header {
margin: 0;
font-size: 1.1em;
$groups: community $community \70, teams $teams \72, college $college \71, for-you $gray \6b;
@each $group in $groups {
&.#{nth($group, 1)} {
color: #{nth($group, 2)};
.feed-icon {