Given the following CoffeeScript class:
class Foo
constructor: ()->
@bar()
bar: ->
$("body").on "click", (e)=>
Given the following CoffeeScript class:
class Foo
constructor: ()->
@bar()
bar: ->
$("body").on "click", (e)=>
class API::Registrar | |
# Is this possible? | |
attr_reader :stripe_customer, :postgres_user, :stripe_card | |
def initialize(user_params, card_params) | |
@postgres_user = initialize_postgres_user(user_params) | |
@stripe_customer = initialize_stripe_customer(user_params) | |
@stripe_card = initialize_stripe_card(card_params) | |
end | |
// | |
// AppDelegate.swift | |
// iTunesKiller | |
// | |
// Created by Silas J. Matson on 12/18/14. | |
// | |
import Cocoa | |
@NSApplicationMain |
# Usage: countdown <n> [second(s)|minute(s)|hour(s)] [message] | |
# Be sure to quote the 'message' argument | |
function countdown(){ | |
if [ -z $1 ]; then | |
echo "Fuzzy Wuzzy wuz a bear, but now he's a sad \ | |
bear because you didn't tell him how long to wait. 🐻" | |
return 1 | |
fi |
module DatabaseQueryStreaming | |
def stream_query_rows(sql_query, options="WITH CSV HEADER") | |
conn = ActiveRecord::Base.connection.raw_connection | |
conn.copy_data "COPY (#{sql_query}) TO STDOUT #{options};" do | |
while row = conn.get_copy_data | |
yield row | |
end | |
end | |
end |
class ApplicationRecord < ActiveRecord::Base | |
extend DatabaseQueryStreaming | |
self.abstract_class = true | |
end |
class SalesReportsController < AdminController | |
include ActionController::Live | |
def export | |
respond_to do |format| | |
format.csv { stream_csv_report } | |
end | |
end | |
private |
query.select(" | |
AVG(sale.price) as average_price, | |
MAX(sale.price) as max_price, | |
MIN(sale.price) as min_price, | |
ROUND(AVG(EXTRACT(EPOCH FROM sale.completed_at) - EXTRACT(EPOCH FROM sale.created_at))) as average_sale_time | |
") |
I hereby claim:
To claim this, I am signing this object:
module RSpec | |
module Core | |
module Formatters | |
class EmojiFormatter < BaseTextFormatter | |
def example_passed(_notification) | |
output.print '👌 ' | |
end | |
def example_pending(_notification) |