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 / backbone_collection_sorting_example.js.coffee
Created March 2, 2013 21:32
Sort Backbone collection by key with direction. Works with both numeric and alphabetical values.
MyApp.FooCollection = Backbone.Collection.extend(
model: MyApp.Foo,
sort_key: 'points',
sort_direction: 'desc'
comparator: (a, b) ->
key_1 = a.get(@sort_key)
@CoralineAda
CoralineAda / foo.js.coffee
Created March 3, 2013 16:14
Save only certain attributes in a Backbone model
MyApp.Foo = Backbone.Model.extend(
urlRoot: '/foos'
defaults:
attrs_to_sync: ['name', 'points']
toJSON: (options) ->
attr = _.clone(@attributes)
json = new Object
@CoralineAda
CoralineAda / time_series.rb
Created June 10, 2013 20:33
Fill in missing daily records in a time-series query against a Mongo datastore using Mongoid.
activities = Activity.where(:date.gte => dates.first, :date.lte => dates.last)
((Date.today - 60.days)..Date.today).map do |date|
activities.where(:date.gte => date.beginning_of_day, :date.lte => date.end_of_day).first || Activity.new(:date => date, :stat => 0)
end
@CoralineAda
CoralineAda / git-browse.txt
Last active December 19, 2015 19:18
Open your current git repo on GitHub from the command line. Recommend setting it as an alias in your ~/.bash_profile. Thanks to Zander (https://github.com/zph) for the assist (based on https://gist.github.com/zph/6b0171954c36146e307e, a shell version in progress.)
git config --get remote.origin.url | ruby -ne 'puts %{https://github.com/#{$_.split(/.com[\:\/]/)[-1].gsub(".git","")}}' | xargs open

Hi.

I'd like tell you about a matter that is quite personal but will result in some changes in the way I present myself and interact with the commnunity.

I am transgender.

I have known that my body did not match my internal gender since I was a very small child, but I kept those feelings hidden and did my best to make my life work with the body I was born into. The result was chronic stress, physical and psychological pain, and a severe depression that culminated in an acute crisis in October of 2012. At that time I entered psychotherapy to explore my options.

I was diagnosed with Gender Identity Disorder, the treatment for which includes psychotherapy, hormonal treatments and potentially several surgeries. I have been working with my therapist and doctors, following the Standards of Care that set out treatment guidelines for my condition.

@CoralineAda
CoralineAda / startup.rake
Last active August 29, 2015 13:56
Start a Rails app with conditional features enabled.
# Needed to load an application without enabling a certain feature unless I explicitly wanted it.
# The use case was not wanting listeners to load unless the server was starting up; otherwise
# running rake or any of the rails aliases would fire up the listener which would block the thread.
# To complete this thought, check for the value of the environment variable in an initializer, e.g.
#
# config/initializers/listeners.rb
# if ENV['WITH_LISTENERS']
# Rails.logger.info "Starting listeners..."
# Listener.start(:customer)
@CoralineAda
CoralineAda / coc_draft.md
Created November 15, 2014 18:40
Contributor CoC v1.0 Draft

Contributor Code of Conduct

Version 1.0

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harrasment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual langauge or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

@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]->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
@CoralineAda
CoralineAda / open_remote_github.md
Last active April 12, 2016 13:29
Open current git repo on GitHub in a browser