Skip to content

Instantly share code, notes, and snippets.

View chrisking's full-sized avatar

Chris King chrisking

View GitHub Profile
@chrisking
chrisking / rb_stories show.html
Created March 20, 2012 17:24
show assigned_to
<div class="assigned_to editable story_field" fieldtype="select" fieldname="assigned_to" fieldlabel="<%=l(:assigned_to)%>">
<div class="t">Assigned To:</div>
<div class="v"><%= assignee_name_or_empty(story) %></div>
</div>
@chrisking
chrisking / gist:2226162
Created March 28, 2012 13:27
Embed the context below in your html file
<script src="https://apps.delta.ncsu.edu/shared-ga/applyyourself_ga.js" type="text/javascript" charset="utf-8"></script>
@chrisking
chrisking / gist:2510891
Created April 27, 2012 17:10
accordion
var ContentOpacity = '1';
var TimeToSlide = 250.0;
var openAccordion = '';
function runAccordion(index)
{
var nID = "Accordion" + index + "Content";
if(openAccordion == nID)
nID = '';
super(context, context.getAssets().openFd("drug.db.mp3").getFileDescriptor().toString(), null, DATABASE_VERSION, R.raw.ormlite_config)
package com.pruvop.drugdb;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import java.util.Calendar;
import java.util.Date;
@chrisking
chrisking / gist:2777412
Created May 23, 2012 19:59
simple test case
public void testAddScheduleCard() {
getInstrumentation().waitForIdleSync();
//Select Add Button
solo.clickOnText("Add Another Time");
assertEquals(solo.searchText("Add Another Time",2), true);
}
@chrisking
chrisking / gist:2783206
Created May 24, 2012 18:12
JS for client
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount','UA-3002088-4']);
_gaq.push(['_setAllowLinker',true],['_setDomainName','www.nextgengovt.com'],['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
@chrisking
chrisking / gist:5187244
Created March 18, 2013 13:47
Validation in django forms
class ContactForm(forms.Form):
name = forms.CharField(label="Name*")
company = forms.CharField(label="Company*")
email = forms.EmailField(label="Email*")
address = forms.CharField(required=False)
city = forms.CharField(required=False)
state = forms.CharField(required=False)
zipcode = forms.CharField(required=False)
country = forms.CharField(required=False)
telephone = forms.CharField(required=False)
def resource_filename(base, path_to_append):
"""
resource_filename takes in any python object, preferably __name__.
It then uses the OS module to determine the full path to the calling
module, then that is joined with any additional path and it
is returned.
"""
base_path = os.path.dirname(os.path.abspath(base))
return os.path.join(base_path, path_to_append)
@chrisking
chrisking / sublime_user.json
Created November 3, 2013 23:53
sublime config
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Tomorrow-Night-Eighties.tmTheme",
"fade_fold_buttons": false,
"font_face": "Consolas",
"font_size": 13,
"highlight_line": true,
"line_padding_bottom": 1,
"line_padding_top": 1,