Skip to content

Instantly share code, notes, and snippets.

View richmolj's full-sized avatar

Lee Richmond richmolj

View GitHub Profile
richmolj ~/code/rubinius $ ./configure
Checking gcc: found
Checking g++: found
Checking bison: found
Configuring LLVM...
Checking for existing LLVM library tree: found!
Checking sizeof(short): 2 bytes
Checking sizeof(int): 4 bytes
Checking sizeof(void*): 8 bytes
__CF_USER_TEXT_ENCODING=0x1A1D6313:0:0
NLS_LANG=AMERICAN_AMERICA.UTF8
Lees-MacBook-Pro:code leerichmond$ export EXECJS_RUNTIME='Node'
irb(main):001:0> require 'execjs'
ExecJS::RuntimeUnavailable: Node.js (V8) runtime is not available on this system
from /Users/leerichmond/rubinius/gems/1.9/gems/execjs-1.4.0/lib/execjs/runtimes.rb:65:in `from_environment'
from /Users/leerichmond/rubinius/gems/1.9/gems/execjs-1.4.0/lib/execjs/runtimes.rb:50:in `autodetect'
from /Users/leerichmond/rubinius/gems/1.9/gems/execjs-1.4.0/lib/execjs.rb:5:in `__script__'
from /Users/leerichmond/rubinius/gems/1.9/gems/execjs-1.4.0/lib/execjs.rb:4:in `__script__'
from kernel/common/codeloader.rb:232:in `require'
from kernel/common/kernel.rb:638:in `gem_original_require (require)'
from /Users/leerichmond/rubinius/lib/rubygems/custom_require.rb:60:in `require'
@richmolj
richmolj / gist:9199292
Last active August 29, 2015 13:56
Matchup div example
api.events.onMatchupView = function(matchup) {
//https://groups.google.com/forum/#!topic/disqus-dev/hi8mm5DtN-s
var id = "seed-"+matchup.contestants[0].seed+"-"+matchup.contestants[1].seed+""
DISQUS.reset({
reload: true,
config: function () {
this.page.identifier = id;
this.page.url = window.location.href + "/#!/" + id;
}
var api = new UpvtIframeApi('#upvt-iframe');
function slugify (str) {
var slugged = str.replace(/^\s+|\s+$/g, '');
slugged = slugged.toLowerCase()
return slugged.replace(/[^a-z0-9 -]/g, '')
.replace(/\s+/g, '-')
.replace(/-+/g, '-')
}
Ruby
{title: 'HR71', yes_vote_count: 100, no_vote_count: 90}
JSON
{"title":"HR71","yes_vote_count":100,"no_vote_count":90}
<fieldset>
<label for="survey_questions_attributes_0_answers_attributes_0_content">Answer</label>
<input id="survey_questions_attributes_0_answers_attributes_0_content" name="survey[questions_attributes][0][answers_attributes][0][content]" size="30" type="text" value="mozzarella">
<input id="survey_questions_attributes_0_answers_attributes_0__destroy" name="survey[questions_attributes][0][answers_attributes][0][_destroy]" type="hidden" value="false">
<a href="#" class="remove_fields">remove</a>
</fieldset>
utf8:✓
_method:put
authenticity_token:hDl1Fox1KyXq1ev3RvhT7euijxj3CJSxGP9jxkgCMmQ=
survey[name]:What's your favorite Pizza?
survey[questions_attributes][0][content]:What's your favorite kind of cheese?
survey[questions_attributes][0][_destroy]:0
survey[questions_attributes][0][answers_attributes][0][content]:mozzarella
survey[questions_attributes][0][answers_attributes][0][_destroy]:false
survey[questions_attributes][0][answers_attributes][0][id]:10
survey[questions_attributes][0][id]:4
function remove_fields(link) {
  $(link).prev("input[type=hidden]").val("1");
  $(link).closest(".fields").hide();
}

function add_fields(link, association, content) {
  var new_id = new Date().getTime();
  var regexp = new RegExp("new_" + association, "g")
 $(link).parent().before(content.replace(regexp, new_id));
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});