This file contains hidden or 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
previousjQuery = jQuery; | |
jQuery(function($){ | |
// only run in browsers that can do localStorage (not IE) and only on the tickets page | |
if ('localStorage' in window && $('body').hasClass('tickets-show')) { | |
// I want to make sure that this always runs with my version of jquery, not zendesk's | |
$.getScript('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js', function(){ | |
jQuery(function($){ | |
function getThisZendeskTicketFromRestApi(callback){ | |
var UrlToThisTicket = window.location.protocol + "//" + window.location.host + window.location.port + window.location.pathname; |
This file contains hidden or 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
use strict; | |
Irssi::signal_add('message public', 'event_substitute_text'); | |
Irssi::signal_add('message private', 'event_substitute_text'); | |
sub event_substitute_text { | |
my ($server, $text, $nick, $address, $target) = @_; | |
my %substitions = ( | |
':\+1:' => '👍', |
This file contains hidden or 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
use strict; | |
Irssi::command_bind jerkins => sub { | |
my ($data, $server, $witem) = @_; | |
return unless $witem; | |
my $poo = ":poop: :persevere: :poop:"; | |
$server->send_raw( | |
"PRIVMSG $witem->{name} :$poo http://ryanflorence.com/gifs/jenkins.gif $poo" | |
); |
This file contains hidden or 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
# log_to_stdout! (useful if you're running this as a script/runner thing) | |
Object.send(:remove_const, :RAILS_DEFAULT_LOGGER) | |
Object.const_set(:RAILS_DEFAULT_LOGGER, Logger.new(STDOUT)) | |
ActiveRecord::Base.logger = Rails.logger | |
Mailman.config.logger = Rails.logger | |
ActiveRecord::Base.connection_handler.clear_all_connections! | |
require 'perftools' # add perftools.rb to your Gemfile | |
time = Time.now.to_i |
This file contains hidden or 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
COURSE_ID = 5 # replace this with id of course with many (>=500) students | |
# generating a large course is left as an exercise to the reader | |
course = Course.find(COURSE_ID) | |
# generate quiz | |
q = course.quizzes.create! :title => "Big Quiz" | |
eval(File.read 'quiz_questions.txt').each_with_index do |(question, as), i| | |
answers = as.map.with_index { |a, j| |
This file contains hidden or 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
[ | |
["The main function of myelin is to", | |
["form a protective coating over nerve axons.", | |
"affect the speed of nerve impulses.", | |
"block the reception of acetylcholine.", | |
"aid a nerve's receptivity to neurotransmitters by increasing the number of receptor sites available."]], | |
["The part of the nerve cell specialized for conducting information is the", | |
["axon.", | |
"cell body.", |
This file contains hidden or 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
grammar Css | |
rule body | |
(styleguide / comment)* { | |
def val | |
Hash[ | |
elements.map(&:val).compact | |
] | |
end | |
} | |
end |
This file contains hidden or 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
.../_cas_settings.html.erb | 8 +- | |
.../_ldap_settings.html.erb | 26 ++-- | |
.../_ldap_settings_fields.html.erb | 38 +++--- | |
.../_ldap_settings_test.html.erb | 22 ++-- | |
.../_saml_settings.html.erb | 18 +-- | |
.../account_authorization_configs/index.html.erb | 6 +- | |
app/views/accounts/_add_course_or_user.html.erb | 6 +- | |
app/views/accounts/_course.html.erb | 6 +- | |
app/views/accounts/avatars.html.erb | 16 +-- | |
app/views/accounts/courses.html.erb | 2 +- |
This file contains hidden or 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
# returns the closest 15 minute interval | |
def closest(n) | |
closest_interval = [0, 15, 30, 45, 60].map { |m| | |
[m, (m - n).abs] | |
}.min_by { |_, minutes_away| | |
minutes_away | |
} | |
closest_interval.first | |
end |
This file contains hidden or 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
(ns irc-proxy.core | |
(:require [clojure.core.async :as async :refer :all])) | |
(def c (chan)) | |
(def quit (chan)) | |
(defn -main [] | |
(go | |
(while true | |
(if-let [v (<! c)] |
OlderNewer