Skip to content

Instantly share code, notes, and snippets.

James Strong laspluviosillas

Block or report user

Report or block laspluviosillas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View after_cleanup.jsx
import React from 'react';
import { ContentBox } from '@core_js/ui_elements';
import { money } from '@core_js/utils';
import SubscriptionPlan from '../../shared/SubscriptionPlan';
const BillingState = ({ state }) => {
switch (state) {
case 'overdue':
return <div className="yellow">Overdue</div>;
case 'delinquent':
View gist:94b2351992e3a1c3e8ca28d030892c3b


Idea: Seek to establish similarities between Machiavelli and Hobbes, talk about some important differences, then conclude with some remarks on how both authors failed to anticipate what would promote peace and liberty as we see in the modern world.

THESIS STATEMENT: On the surface, Hobbes and Machiavelli appear to advocate for polar opposite forms of government. Although their ideologies are different in paper, there are surprising similarities in how they believe liberty and peace are maintained in practice. However, in the end, but both of these thinkers failed to forsee what has proven to secure liberty and peace in the modern world.

Main Point #1: Hobbes and Machiavelli have conflicting definitions of liberty, which creates the illusion that their beliefs on how society should be ordered are incompatible with one another.

laspluviosillas /
Created Jun 13, 2017
Using python comprehension to analyze enron data. (udacity machine learning)
# ===========================================
# Output first entry from dict to see values.
# ===========================================
# print enron_data[enron_data.keys()[0]]
# =============================
# Get # of persons of interest
# (uses dict comprehension)
# ============================
laspluviosillas / polymorphic.rb
Created Apr 13, 2017
Issue with polymorphic associations
View polymorphic.rb
class Task < ActiveRecord::Base
has_one :notification_preference, as: :notifee
class NotificationPreference < ActiveRecord::Base
belongs_to :notifee, polymorphic: true
# Code above keeps on looking for notifee_id on Task.
# The foreign keys are obviously in the NotificationPreference table (notifee_id and notifee_type)
laspluviosillas / before_action.rb
Last active Aug 29, 2015
Pseudo before_action
View before_action.rb
def before_action(options = {})
if options[:if].present?
return if !send(options[:if])
View example.rb
params[:q][:created_at_gt] = params[:q][:created_at_gt].to_datetime if params[:q][:created_at_gt]
params[:q][:created_at_lt] = params[:q][:created_at_lt].to_datetime.end_of_day if params[:q][:created_at_gt]
@q =[:q]) # search is perfomed by ransack
sessions = @q.result
params[:q][:created_at_gt] = params[:q][:created_at_gt].to_date if params[:q][:created_at_gt]
params[:q][:created_at_lt] = params[:q][:created_at_lt].to_date if params[:q][:created_at_gt]
laspluviosillas / index.html
Created Sep 18, 2014 HTML viewer debug.
View index.html
<!DOCTYPE html>
<link rel="stylesheet" href="crocodoc.viewer.min.css" />
<script src="//"></script>
<script type="text/javascript" src="crocodoc.viewer.min.js"></script>
<div class="viewer" style="height: 400px"></div>
<script type="text/javascript">
var viewer = Crocodoc.createViewer('.viewer', {
url: ''
View example.rb
class Project
mount_sf_api :sf_setup do |s|
s.api ""
s.fields [
:agree_memo, :agree_to_transport, :challenges_description,
:created_at, :culture_description, :description,
:dining_location, :guidelines_description, :housing_description,
:housing_type, :internet_distance, :location_city, :location_country,
:location_description, :location_private, :location_state_or_province,
:location_street_address, :location_type, :max_students,
View gist:10488388

Problem with Products & Offerings

  • These products are included in the wsProducts script, but not in wsOfferings script. As a result, the home page shows the following products with a price of zero:

Total: 48 from 117

247 Office Ergonomics
215 Defensive Driving Course
214 Front End Loader Training
laspluviosillas / example.rb
Created Feb 7, 2014
Example loading chargify statements to get subtotal.
View example.rb
s = Chargify::Statement.find(27478308)
transactions = s.transactions.reject { |t| t.type == "Payment" }
total_cents = transactions.sum(&:amount_in_cents)
total = total_cents.to_f/100 # to_f necessary otherwise decimals are truncated.
You can’t perform that action at this time.