d3.unconf example gist. Fork it here.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.Swiftype = window.Swiftype || {}; | |
Swiftype.root_url = Swiftype.root_url || 'https://api.swiftype.com'; | |
Swiftype.pingUrl = function (endpoint, callback) { | |
var img = new Image(); | |
img.onload = img.onerror = callback; | |
img.src = endpoint; | |
setTimeout(callback, 350); | |
return false; | |
}; | |
Swiftype.pingSearchResultClick = function (engineKey, docId, callback) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var customResultRenderFunction = function(ctx, results) { | |
var $list = ctx.list, | |
config = ctx.config; | |
$.each(results, function(document_type, items) { | |
$.each(items, function(idx, item) { | |
var $node = $('<li>' + item['title'] + '</li>'); | |
$node.data('document_type', document_type); // saves document_type for later access | |
$node.appendTo($list); | |
ctx.registerResult($node, item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"auto_indent": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"detect_indentation": true, | |
"draw_white_space": "selection", | |
"ensure_newline_at_eof_on_save": true, | |
"file_exclude_patterns": | |
[ | |
"*.pyc", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// non-id/name attributes are interpreted as cdata | |
// per: http://www.w3.org/TR/html4/types.html#type-cdata | |
var s = "<p title=\"<script>alert('TEST')</script>\">testing 123</p>"; | |
document.body.innerHTML = s; | |
document.getElementsByTagName('p')[0].getAttribute('title'); | |
// => "<script>alert('TEST')</script>" | |
document.getElementsByTagName('p')[0].title; | |
// => "<script>alert('TEST')</script>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set(reg: Reg, literal: byte): Code = { | |
return new Code() { | |
// implementation | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'gchart' | |
data = <<HERE | |
Net::HTTPServerException: 14 | |
ActiveRecord::StatementInvalid: 126 | |
no_data: 27814 | |
Errno::EPIPE: 4 | |
ScalaNet::UnknownHostException: 100359 | |
EOFError: 9498 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define_builder(Country) do |klass, overrides| | |
# set up some presets | |
canada = { :iso => 'CA', :name => 'CANADA', :printable_name => 'Canada', :iso3 => 'CAN', :numcode => '124'} | |
usa = { :iso => 'US', :name => 'UNITED STATES', :printable_name => 'United States', :iso3 => 'USA', :numcode => '840' } | |
uk = { :iso => 'GB', :name => 'UNITED KINGDOM', :printable_name => 'United Kingdom', :iso3 => 'GBR', :numcode => '826' } | |
zimbabwe = { :iso => 'ZW', :name => 'ZIMBABWE', :printable_name => 'Zimbabwe', :iso3 => 'ZWE', :numcode => '716' } | |
# set up the default | |
country_attributes = canada | |
# check for a preset | |
overrides.process(:preset) do |preset| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define_builder(Page) do |klass, overrides| | |
klass.new(:page_title => "foo.com", :page_id => 123) | |
end | |
define_builder(Summary) do |klass, overrides| | |
klass.new(:page_id => new_page.page_id, :user => new_user, :summary => "foobar") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Exceptions < Application | |
# handle RecordInvalid exceptions (406) | |
def record_invalid | |
@errors = request.exceptions.first.errors | |
rename_error_fields! | |
if content_type == :html | |
render {:template => "#{request.controller}/#{request.params[:action]}"} | |
else | |
render |
NewerOlder