Skip to content

Instantly share code, notes, and snippets.

View flemdizzle's full-sized avatar

Steven Fleming flemdizzle

View GitHub Profile
{"marketplace"=>"Sennheiser Amazon", "customer_data"=>{"first_name"=>"Pending", "last_name"=>"AmazonCustomer", "phone_number"=>"1234567890", "email"=>"pending_amazon@optiturn.com"}, "billing_address"=>nil, "shipping_address"=>nil, "marketplace_identifier"=>"113-0740836-1481042", "shipping_method"=>"Two-Day", "status"=>"pending", "sold_price_cents"=>0, "shipping_cents"=>0, "tax_cents"=>0, "purchased_at"=>"2018-10-08T19:48:29.044Z", "marketplace_order_items"=>[{"sku"=>"15-1425632-9", "marketplace_identifier"=>"47908235845746", "sold_price_cents"=>0, "shipping_cents"=>0, "tax_cents"=>0, "unit"=>{"bulk_listing_id"=>nil, "cached_condition_multiple"=>0.797136, "cached_current_asking_price_cents"=>23070, "cached_current_condition_id"=>9, "client_catalog_entry_id"=>10344021, "client_lp"=>nil, "client_sku"=>"507390", "client_vendor_id"=>nil, "created_at"=>"2018-06-27T09:56:35-04:00", "current_appraisal_id"=>21944865, "details"=>nil, "grouping_condition_id"=>nil, "id"=>16277136, "internal_id"=>nil, "listing_reservation
@flemdizzle
flemdizzle / bubkis.rb
Last active August 20, 2018 20:12
Readable
p Array
.new(10000){Array.new(6){rand(1..6)}}
.reject do |roll|
roll.include?(1) ||
roll.include?(5) ||
roll.select{ |die| roll.count(die) > 2 }.any? ||
roll.sort.chunk_while{ |previous_die, current_die| previous_die == current_die }.count != 4 }
end
.count.to_f/10000
@flemdizzle
flemdizzle / bubkis.rb
Last active August 20, 2018 20:21
CODE GOLF: bubkis frequency calculation in ruby for 10K iterations
p Array.new(10000){Array.new(6){rand(1..6)}}.reject{|r|r.include?(1)||r.include?(5)||r.any?{|d|r.count(d)>2}||r.sort.chunk_while{|p,c|p==c}.count!=4}.size.to_f/10000
validationPlaceholder() {
if (this.state.validation_error && this.state.validation_data.status === 'required') {
return 'REQUIRED';
}
},
toggleInput() {
if (this.props.edit) {
return (
<div>
- text_section: 'The lazy dog'
part_of_speech: 'verb'
- text_section: 'over the brown fox. This little'
part_of_speech: 'type of animal'
- sentence_beginning:
- 'lazy'
- 'dog'
@flemdizzle
flemdizzle / evaluation.js.jsx
Created February 5, 2017 16:56
Some JSX code to send to Jon
var Evaluation = React.createClass({
getInitialState: function() {
return {evaluation: this.props.evaluation};
},
updateData: function(form, data) {
var index = this.state.evaluation.indexOf(form);
var form_data = React.addons.update(this.state.evaluation[index].form,
{ $merge: data });
form.form = form_data;
def self.available_bikes(distance, id)
doc = Nokogiri::XML(open("http://www.capitalbikeshare.com/data/stations/bikeStations.xml"))
# spits out the number of bikes at a given station
doc.xpath('//station').each do |node|
if node.children[0].text == "#{id}"
latitude = node.children[4].text
distance = distance.round(2)
longitude = node.children[5].text
bikes = node.children[12].text
docks = node.children[13].text
/* CSS declarations go here */
body {
font-family: sans-serif;
background-color: #315481;
background-image: linear-gradient(to bottom, #315481, #918e82 100%);
background-attachment: fixed;
position: absolute;
top: 0;
bottom: 0;
var StudentListView = Backbone.View.extend({
tagName: 'div',
className: 'students-list',
template: _.template($('#students-list-template').html()),
initialize: function(){
this.listenTo(this.collection, 'sync', this.render);
},
events: {
'submit form': 'onSubmit'
},