Skip to content

Instantly share code, notes, and snippets.

(defn -main []
(let [c1 (chan)
c2 (chan)]
(go-loop []
(let [a (<! c1)]
(println a)
(Thread/sleep 1000)
(>! c2 2)
(recur)))
(go-loop []
(defn -main []
(let [c1 (chan)
c2 (chan)]
(go-loop []
(let [a (<! c1)]
(println a)
(Thread/sleep 1000)
(>! c2 2)
(recur)))
(go-loop []

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
st = Imports::SharedTag.where(subject_name: 'alex').first
ids = st.tag_sharees.map(&:id).map(&:to_s)
ids.each { |id| Resque.enqueue(ResyncSharedTag, id) }
@afurmanov
afurmanov / gist:7918525
Last active December 31, 2015 02:09
NBEC->NBUILD import SQL
SELECT COUNT(*) FROM staging_axjd;
SELECT min(id), max(id) FROM staging_axjd;
DROP TABLE IF EXISTS registered_addresses_working;
CREATE TEMPORARY TABLE registered_addresses_working ("row_id" serial, "id" int, "inserted" boolean, "updated_at" timestamp, "zip" TEXT, "lng" numeric, "lat" numeric, "geocode_accuracy" int, "fips" TEXT, "address1" TEXT, "address2" TEXT, "city" TEXT, "county" TEXT, "state" TEXT, "country_code" TEXT, "geocode_city" TEXT, "geocode_address1" TEXT, "geocode_state" TEXT, "geocode_zip" TEXT, "geocode_country_code" TEXT, "geocode_error_count" int, "street_name" TEXT, "street_type" TEXT, "unit_number" TEXT, "identity_hash" TEXT, "street_number" TEXT, "street_prefix" TEXT, "street_suffix" TEXT, "unit_number_integer" int, "street_number_integer" int);
INSERT INTO registered_addresses_working ("inserted", "updated_at", "zip", "lng", "lat", "geocode_accuracy", "fips", "address1", "address2", "city", "county", "state", "country_code", "geocode_city", "geocode_address1", "geocode_state", "geoc
module NamedScopeArity
extend ActiveSupport::Concern
module ClassMethods
def scope(name, scope_options = {})
super
redefined = false
eigenclass = instance_eval do
class << self
self
end

I've recently noticed I have no new data in my web_log table, after some short investigation I figured couple things:

  1. I have no web_log table anymore
  2. I cannot write anything into log.

Here is a very simple script demonstrating problem:

require 'rubygems'

require 'nokogiri'
module GData
module Atom
class ElementWithId < Base
elements 'atom:id'
elements 'atom:title', 'atom:author*' => Author, 'atom:category*' => Category
elements 'atom:contributor*', 'atom:summary?'
elements 'atom:updated' => DateTime, 'atom:link*' => Link
/animal/protocol/approved
Parameters
{"commit"=>"Submit", "search"=>"", "protocol"=>{"project_title"=>"Molecular Pathways in Hoxb4 Mediated Hematopoietic Stem Cell Development", "protocol_species_attributes"=>{"new_1283437301316"=>{"id"=>"", "breeding_animals"=>"false", "total_quantity"=>"220", "species_id"=>"8"}}, "expiration_date"=>"August 30, 2013", "funding_source_name"=>"March of Dimes", "full_protocol_attachments"=>{"new"=>{"new_ATTACHMENT_REPLACE_ME"=>{"attachment_initialize_param"=>"", "description"=>""}}}, "approval_date"=>"August 30, 2010", "overall_protocol"=>"no", "protocol_pi_attributes"=>{"id"=>"", "user_id"=>"6607"}, "hold_reason"=>"", "external_funds"=>"true", "internal_funds"=>"true", "protocol_number"=>"1008162", "is_va_funded"=>"no", "comment"=>"", "hold"=>"false", "state"=>"approved"}, "action"=>"create", "controller"=>"animal/protocol/approved"}
Created at
Thu Sep 02 09:21:59 -0500 2010
User Agent
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .