Skip to content

Instantly share code, notes, and snippets.

View CoralineAda's full-sized avatar
💭
Making trouble as usual

Coraline Ada Ehmke CoralineAda

💭
Making trouble as usual
View GitHub Profile
@CoralineAda
CoralineAda / ds_store.md
Created April 19, 2024 00:08
Recursively delete .DS_Store files
find . -name .DS_Store -print0 | xargs -0 rm

Keybase proof

I hereby claim:

  • I am coralineada on github.
  • I am coralineada13 (https://keybase.io/coralineada13) on keybase.
  • I have a public key ASD295ulEpugWN5kKtqVHr0O9-ZZkgqzgXeJrNZCSsM2mgo

To claim this, I am signing this object:

# config/initializers/attribute_types.rb
ActiveRecord::Type.register(:discount_line_type, DiscountLineType)
# discount_line_type.rb
class DiscountLineType < ActiveRecord::Type::Value
DISCOUNT_LINE = Struct.new(:name, :description, :amount, keyword_init: true)
def type
:jsonb
end
p (1..100).map{|i| (i % 15 == 0 && "fizzbuzz") || (i % 3 == 0 && "fizz") || (i % 5 == 0 && "buzz") || i} * ","
@CoralineAda
CoralineAda / chunker.rb
Last active May 29, 2017 20:11
Recursive solution to breaking up arbitrary text into tweet-sized chunks
class Chunker
def chunk_message(message, handle="", chunked=[])
return chunked unless message.present?
chunks = message.split
proposed_chunk = [handle, chunked.last, chunks[0]].compact.join(' ').squish
if proposed_chunk.length <= 140
chunked << [chunked.pop, chunks.shift].compact.join(' ')
else
chunked << chunks.shift
@CoralineAda
CoralineAda / lhc_coc.md
Created September 26, 2016 15:52
LHC Slack Code of Conduct

Community Covenant

Our Goal

This community is dedicated to providing a harassment-free experience for everyone. We do not tolerate harassment of participants in any form.

Applicability and Scope

This code of conduct applies to all of this community's spaces, including public channels, private channels and direct messages, both online and off. Anyone who violates this code of conduct may be sanctioned or expelled from these spaces at the discretion of the administrators.

What are you looking for in a mentor? What are your short-term and long-term goals? How do you best work with people? What level of experience with Ruby do you feel you have? What is it that you really want to be and do? What are you doing really well to help you get there? What could you be doing better in terms of getting there? How can I best help you achieve your goals? Have you had a mentor before, and if so, what was the experience like? What makes you happiest?

(begin
(send nil :require
(str "spec_helper"))
(block
(send nil :describe
(const nil :Project))
(args)
(begin
(block
(send nil :describe
@CoralineAda
CoralineAda / open_remote_github.md
Last active April 12, 2016 13:29
Open current git repo on GitHub in a browser
@CoralineAda
CoralineAda / neo4jquery.md
Created December 29, 2014 14:31
Neo4J query question

I have a relation like this:

context-[EXPRESSED_AS]->root

Assume that I have two contexts. The first has roots with base_forms of "temperature", "cool" and "hot". The second has roots with base_forms of "cool" and "hot". I want to find all contexts, sorted by the number of matches for the set ["cool", "temperature"].

I attempted it using this Cypher query, which doesn't work since the IN operator returns true or false instead of the matches:

"MATCH (w:`context`), s-[EXPRESSED_AS]-&gt;n1 WHERE n1.base_form in ["cool", "temperature"] WITH s, COUNT(n1.base_form in ["cool", "temperature"]) AS rootCount RETURN s.name, rootCount ORDER BY rootCount