Skip to content

Instantly share code, notes, and snippets.

View jvnill's full-sized avatar

Jim Ruther Nill jvnill

View GitHub Profile
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Include gadget (iframe)" title_url="http://sites.google.com/"
description="Include another web page in your Google Site"
thumbnail="https://www.gstatic.com/sites-gadgets/common/images/sites-icon-gadget-thumb.png"
screenshot="https://www.gstatic.com/sites-gadgets/common/images/sites-icon-gadget-ss.png"
height="800" width="600" author="Google">
<Require feature="dynamic-height"/>
</ModulePrefs>
<UserPref name="iframeURL" display_name="URL to content" required="true"/>
@jvnill
jvnill / rails http status codes
Created May 18, 2016 03:50 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
>> str="D:\\projects\\curator\\java\\hpc"
=> "D:\\projects\\curator\\java\\hpc"
>> no=str.count("\\")
=> 4
>> splitstr=str.split(pattern="\\",no+1)
=> ["D:", "projects", "curator", "java", "hpc"]
>> splitstr.length
=> 5
=> item_list = Project.limit(2).select('projects.name')
=> [#<Project name: "SEO">, #<Project name: "Site Analysis">]
>> item_list.each { |il| il.name = 'foo' }
=> [#<Project name: "foo">, #<Project name: "foo">]
>> item_list.first
=> #<Project name: "foo">
ActionView::Template::Error (Illegal nesting: nesting within plain text is illegal.):
1: %ol
2: foo
3: foo
4:
@jvnill
jvnill / netengine_golf.rb
Last active December 10, 2015 00:19 — forked from jp/netengine_golf.rb
require 'rspec'
require 'json'
require 'active_support/all'
require 'pry'
def input
[
{lastmodificationdate:"2012-11-16",userproject:'FCBIZ',totalcost:10},
{lastmodificationdate:"2012-11-16",userproject:'LMS',totalcost:20},
{lastmodificationdate:"2012-11-16",userproject:'NetEngine',totalcost:52},
require 'rspec'
require 'json'
require 'active_support/all'
require 'pry'
def input
[{:lastmodificationdate=>"2012-12-20T23:26:34Z",
:totalcost=>30.827698,
:userproject=>"FCBIZ"},
{:lastmodificationdate=>"2012-12-20T23:26:34Z",
@jvnill
jvnill / 0-readme.md
Created November 23, 2012 02:33 — forked from sj26/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p194 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

@jvnill
jvnill / client.rb
Created November 21, 2012 15:06
Core associations between contract, client, code and codeline
class Client < ActiveRecord::Base
attr_accessible :etc, :firstname, :lastname, :mi
has_many :contracts
validates :firstname, :lastname, :mi, presence: true
def full_name
"#{firstname} #{mi} #{lastname}"
end
def attempt_login
if authorized_user = User.authenticate(params[:username], params[:hashed_password])
session[:user_id] = authorized_user.id
session[:username] = authorized_user.username
case authorized_user.account_type
when "admin"
redirect_to :action => "index"
when "it"
redirect_to :action => "it"