Skip to content

Instantly share code, notes, and snippets.

View jefflarkin's full-sized avatar
🙃
Happy

Jeff Larkin jefflarkin

🙃
Happy
View GitHub Profile
@jefflarkin
jefflarkin / JQuery Sortable Searialize
Created February 7, 2009 22:01
Sample code using JQuery Sortable lists. I've fixed my mistake, the code below should now work.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<style type="text/css">
#sortable ul {
list-style: none;
display: inline;
padding: 0;
margin-left: 0;
http://chart.apis.google.com/chart?cht=lc&chs=400x250&chd=t:24.4,28.1,25.6,24.3|26,26&chds=23.0,30.0&chco=ff0000,0000ff&chxt=y&chxr=0,23,30&chdl=Economy|Average&chf=bg,lg,90,888888,0.5,dddddd,0&chxs=0,ffffff&chma=25,25,25,25
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/reset/reset-min.css"/>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/fonts/fonts-min.css"/>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/base/base-min.css"/>
<style media="all" type="text/css">
#admin {
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test</title>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/reset/reset-min.css"/>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/fonts/fonts-min.css"/>
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.7.0/build/base/base-min.css"/>
<style media="all" type="text/css">
html, body {
# Sanitizing/Escaping HTML in the view is inefficient because it
# happens every time the view is rendered. This module forces
# text and string fields to be sanitized every time they are
# modified and saved to the database.
module Sanitizer
def sanitize_fields
columns = self.class.columns_hash
changes.each do |key,value|
if columns[key].type == :text
Sanitize.clean! value[1], Sanitize::Config::TEXTAREA
@jefflarkin
jefflarkin / gist:518961
Created August 11, 2010 13:19
My Favorite BASH Trick
$ make foo
...
$ ^foo^bar
make bar
@jefflarkin
jefflarkin / gist:658822
Created November 1, 2010 20:37
A quick-and-dirty way to get the memory usage of the current process in Linux. Read /proc/self/status. The line VmHWM will tell you the memory highwater mark (max used) and VmRSS will give you the current memory usage.
:) cat /proc/self/status
Name: cat
State: R (running)
SleepAVG: 89%
Tgid: 13668
Pid: 13668
PPid: 24697
TracerPid: 0
Uid: <removed>
Gid: <removed>
@jefflarkin
jefflarkin / charactersheet.xml
Created September 21, 2011 01:14
LOTRO Data API Results
<?xml version="1.0" encoding="UTF-8" ?>
- <apiresponse>
- <character name="Mathrid" world="Crickhollow" monster="0" race="Race of Man" race_id="23" class="Champion" class_id="172" level="30" origin="Dale" origin_id="16">
- <vocation name="Woodsman" vocation_id="1879062814">
- <professions>
<profession name="Woodworker" profession_id="1879055941" proficiency="2" mastery="1" icon_profession="http://lorebook.lotro.com/icon.php?type=profession&id=1879055941" />
<profession name="Farmer" profession_id="1879062816" proficiency="0" mastery="0" icon_profession="http://lorebook.lotro.com/icon.php?type=profession&id=1879062816" />
<profession name="Forester" profession_id="1879062817" proficiency="2" mastery="2" icon_profession="http://lorebook.lotro.com/icon.php?type=profession&id=1879062817" />
</professions>
</vocation>
@jefflarkin
jefflarkin / 1test.F90
Created October 25, 2012 14:42
Testing Derived Types with OpenACC
module dtmod
implicit none
private
integer, public, parameter :: N = 64
type, public :: mytype
sequence
real(8) :: a(N,N)
real(8) :: b(N,N)
end type mytype
end module
program mm
use omp_lib
integer(8), parameter :: N = 4096
integer(8) :: i,j,k,tmp6,tmp2
real(8), dimension(N,N) :: A, B, C
real(8) :: tmp, chk, t0, t1, t2, t3
t0 = omp_get_wtime()
!$acc data create(A,B,C)
!$acc kernels