Skip to content

Instantly share code, notes, and snippets.

View rklancer's full-sized avatar

Richard Klancer rklancer

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Simple Molecules</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geo.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js"></script>
<style type="text/css">
{
"name": "Untitled Document",
"guid": 11,
"components": [
{
"type": "DG.GameView",
"guid": 101,
"componentStorage": {
"currentGameName": "CartWeight",
"currentGameUrl": "http://localhost:8000/CartWeight/",
getContext <- function(re, data=sampleData) {
reWithContext <- paste0(".{0,10}", re, ".{0,10}")
context <- data[grep(reWithContext, data$text, perl=T),]
m <- regexpr(reWithContext, context$text, perl=T)
cbind(context, data.frame(context=regmatches(context$text, m)))
}
writeOut <- function(df, fname) {
f <- file(fname, 'wt')
for (rownum in 1:nrow(df)) {
asciify <- function(text) {
text <- stri_trans_general(text, 'Any-Latin')
text <- stri_trans_general(text, 'Any-Publishing')
text <- stri_trans_general(text, 'Latin-Ascii')
text
}
@rklancer
rklancer / arg-block.rb
Last active August 29, 2015 14:18
Queries for Arg Block report
# Start with a list of endpoints; here we just use all of them
endpoints = Run.where("remote_endpoint IS NOT NULL").map &:remote_endpoint
select_params = [
{
:embeddable_type => "Embeddable::OpenResponse",
:embeddable_table => "embeddable_open_responses",
:answer_table => "embeddable_open_response_answers",
:question_foreign_key => "open_response_id",
:feedback_table => "c_rater_feedback_items",
...
introView: SC.StackedView.design({
layout: { top: 20, bottom: 20 },
childViews: [
SC.LabelView.design(SC.StaticLayout, {
useStaticLayout: YES,
classNames: ['append-to-me'],
escapeHTML: NO,
displayValue: "So, I'm a big ol' string of text. <br><br>And I'm another string of text."
})]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Raphael graphs</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript" src="javascripts/raphael/raphael.js"></script>
<link rel="stylesheet" href="stylesheets/apidocs.css">
/*globals $ Raphael */
// make these accessible at the Firebug/Web Inspector console
var r, group;
$(function () {
var notHighlighted = {
stroke: "#aaaaaa",
fill: "#aaaaaa"
/*globals $ Raphael */
// make these accessible at the Firebug/Web Inspector console
var r, group;
$(function () {
var notHighlighted = {
stroke: "#aaaaaa",
fill: "#aaaaaa"
module("Smartgraphs.questionSequenceController question-sequence navigation", {
setup: function () {
Smartgraphs.Question.FIXTURES = [
SC.mixin(SC.copy(qhash), {guid: 'q1', sequence: 'test-sequence-1'}),
SC.mixin(SC.copy(qhash), {guid: 'q2', sequence: 'test-sequence-2'})
];
Smartgraphs.QuestionSequence.FIXTURES = [
{ guid: 'test-sequence-1', questions: ['q1'] },
{ guid: 'test-sequence-2', questions: ['q2'] }