Skip to content

Instantly share code, notes, and snippets.

View khopkins218's full-sized avatar

Kevin L. Hopkins khopkins218

  • Zeta
  • Charlottesville, VA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am khopkins218 on github.
  • I am khopkins (https://keybase.io/khopkins) on keybase.
  • I have a public key ASAnUU3gNerhPGF6B7HfvzB7biuRIK7nDYiYU2alcI-Mdwo

To claim this, I am signing this object:

namespace :client do
desc 'Start the client React app development server'
task start: [:environment] do
system_command "#{env_vars} yarn start"
end
# Send the value to the client
def client_env_vars
%w[
GOOGLE_ANALYTICS_ID
describe '#transactions' do
before(:all) do
@relationship_1 = create(:marriage)
@user = @relationship_1.user
@partner = @relationship_1.partner
@relationship_2 = create(:marriage, user: @partner, partner: @user)
@user_personal_private = create(:account, user: @user, ownership: 'personal', visibility: 'private')
@user_personal_viewable = create(:account, user: @user, ownership: 'personal', visibility: 'viewable')
@user_shared = create(:account, user: @user, ownership: 'shared')

Testing something with public gists.

@khopkins218
khopkins218 / downloader.rb
Last active August 29, 2015 14:19
NPR Story Puller with some OO
class Downloader
attr_accessor :stories, :selection
def initialize(selection = nil, stories)
self.stories = stories
self.selection = selection
end
def current_story
stories[selection - 1]
@khopkins218
khopkins218 / main.rb
Created April 16, 2015 20:24
NPR Story Puller
require 'rest-client'
response = JSON.parse(RestClient.get("http://api.npr.org/query?id=10001&fields=title,teaser,audio,artist&requiredAssets=audio&dateType=story&sort=dateDesc&output=JSON&numResults=20&apiKey=MDE4ODc1MDMwMDE0MjkxNDI3MDc0NTgzNg001"))
stories = {}
response["list"]["story"].each_with_index do |story, index|
stories[index + 1] = {
title: story['title']['$text'],
audio_file: story['audio'].first['format']['mp3'].first['$text']
}
@khopkins218
khopkins218 / schedule_spec.rb
Created February 3, 2014 16:23
Schedule Checker for valid rake tasks. Takes the schedule.rb file from and extracts the defined rake tasks to check for validity (spelling, actual task, etc)
require 'spec_helper'
describe "schedule" do
describe "file" do
it "should be present and named correctly" do
expect {
File.exists?("#{Rails.root}/config/schedule.rb")
}.to be_true
end
end
@khopkins218
khopkins218 / image-sprite-css-generator.html
Created May 30, 2012 16:50
Custom Image Sprite navigation CSS generator
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<title>Nav CSS Generator of Awesomeness</title>
</head>
<body>
<!-- Developed by Kevin L. Hopkins (http://kevin.h-pk-ns.com)
You may borrow, steal, use this in any way you feel necessary but please
leave attribution to me as the source. If you feel especially grateful,
@khopkins218
khopkins218 / cachedImageView.js
Created January 17, 2012 18:58 — forked from gcoop/cachedImageView.js
Appcelerator Titanium ImageView /w cache and cacheage. Supports retina display.
cachedImageView = function(basedir, uri, obj, attr, cacheage) {
/**
Appcelerator Titanium ImageView /w cache
This function attempts to cache a remote image and then returns it again
when it's requested.
The file is stored in a directory "basedir," this is to try and help
you keep files unique. It's not special or magical, but not dirty either.
/*
Developed by Kevin L. Hopkins (http://kevin.h-pk-ns.com)
You may borrow, steal, use this in any way you feel necessary but please
leave attribution to me as the source. If you feel especially grateful,
give me a linkback from your blog, a shoutout @Devneck on Twitter, or
my company profile @ http://wearefound.com.
/* Expects parameters of the directory name you wish to save it under, the url of the remote image,
and the Image View Object its being assigned to. */
cachedImageView = function(imageDirectoryName, url, imageViewObject)