Skip to content

Instantly share code, notes, and snippets.

View joelr's full-sized avatar

Joel Richards joelr

View GitHub Profile
#Not between 5:30pm Friday and 5:30pm Sunday
def support_available?(time_check = nil)
time_check ||= Time.now
!(time_check.wday == 6 || (time_check.wday == 5 && (time_check.hour > 17 || (time_check.hour == 17 && time_check.min >= 30))) || (time_check.wday == 0 && (time_check.hour < 17 || (time_check.hour == 17 && time_check.min <= 30))))
end
151341
160499
168617
1223
181622
1138
27725
37373
57440
1489
@joelr
joelr / gist:4690768
Created February 1, 2013 11:27
Random purchaser
cart = Cart.new
cart.add_product RandomProduct.find
puts cart.total
cart.pay
#Gives me:
$ ruby app.rb
Adding Motion Activated Flashing RGB LED Wheel Lights for Bikes and Cars (2-Pack)
OmniAuth::Strategies::Passport.default_options.client_options.site = 'http://localhost:3009'
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type='text/javascript'>
$(function() {
$.getJSON('http://api.jo.je/justgiving/jsonp.php?d=Team-Prologis&callback=?', {}, function (data) {
$("#raised-jg").html(data.donations_total);
This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/joel/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin13.0.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Users/joel/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin13.0.0/libxml2/2.8.0)...
* Stopping Elasticsearch Server 
[ OK ]
--2014-10-24 04:35:37-- https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.deb
Resolving download.elasticsearch.org (download.elasticsearch.org)... 107.22.222.16, 54.243.77.158, 54.225.133.195, ...
Connecting to download.elasticsearch.org (download.elasticsearch.org)|107.22.222.16|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19091206 (18M) [application/x-debian-package]
Saving to: ‘elasticsearch-1.1.1.deb’
** [out :: 10.21.88.51]
** [out :: 10.21.88.51] WARNING on line 114 of /var/www/apps/supporter/releases/20150205232915/app/assets/stylesheets/shared/_form_fields.css.sass: ".form__field--search" failed to @extend "%padding-r-l".
** [out :: 10.21.88.51] The selector "%padding-r-l" was not found.
** [out :: 10.21.88.51] This will be an error in future releases of Sass.
** [out :: 10.21.88.51] Use "@extend %padding-r-l !optional" if the extend should be able to fail.
** [out :: 10.21.88.51]
** [out :: 10.21.88.51]
** [out :: 10.21.88.51] WARNING on line 114 of /var/www/apps/supporter/releases/20150205232915/app/assets/stylesheets/shared/_form_fields.css.sass: ".form__field--search" failed to @extend "%padding-r-l".
** [out :: 10.21.88.51] The selector "%padding-r-l" was not found.
** [out :: 10.21.88.51] This will be an error in future releases of Sass.
@joelr
joelr / LB example.md
Last active October 19, 2015 23:07
LB example.md

sort_by=calories&group_by=team&filter[campaign]=au-123,au-456&filter[date_start]=2015-01-01&filter[date_end]=2015-01-01 This should group by team_page_id on the document

[
   {
     team: {
       name: 'Team abc',
 url: 'http://def',
"--- !ruby/object:MIME::Type\ncontent-type: image/jpeg\nfriendly:\n en: JPEG Image\nencoding: base64\nextensions:\n- jpeg\n- jpg\n- jpe\nreferences:\n- IANA\n- RFC2045\n- RFC2046\nxrefs: !ruby/hash:MIME::Types::Container\n rfc:\n - rfc2045\n - rfc2046\nregistered: true"