This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns kata-lights-out.core | |
| (:require [reagent.core :as reagent :refer [atom]])) | |
| ;; ------------------------- | |
| ;; Views | |
| (def lights (atom [[1 1 1][1 1 1][1 1 1]])) | |
| (defn neighbors [[x0 y0]] | |
| (for [x (range 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://stackoverflow.com/questions/22667401/postgres-json-data-type-rails-query | |
| http://stackoverflow.com/questions/40702813/query-on-postgres-json-array-field-in-rails | |
| #payload: [{"kind"=>"person"}] | |
| Segment.where("payload @> ?", [{kind: "person"}].to_json) | |
| #data: {"interest"=>["music", "movies", "programming"]} | |
| Segment.where("data @> ?", {"interest": ["music", "movies", "programming"]}.to_json) | |
| Segment.where("data #>> '{interest, 1}' = 'movies' ") | |
| Segment.where("jsonb_array_length(data->'interest') > 1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package auth | |
| import ( | |
| "crypto/rsa" | |
| "encoding/base64" | |
| "encoding/binary" | |
| "encoding/json" | |
| "fmt" | |
| "io/ioutil" | |
| "log" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| due_date = Date.parse('2019-03-31') | |
| instalments = Installment.delinquent. | |
| where(due_date: due_date). | |
| joins(:loan => :merchant). | |
| where('DATE(loans.delinquent_at) = ?',due_date). | |
| merge(Merchant.active) | |
| instalments.find_each do |installment| | |
| begin | |
| if installment.payment_method&.debit? |
OlderNewer