Command Line
pry -r ./config/app_init_file.rb- load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb- load your rails into a pry session
Debugger
| // Just before switching jobs: | |
| // Add one of these. | |
| // Preferably into the same commit where you do a large merge. | |
| // | |
| // This started as a tweet with a joke of "C++ pro-tip: #define private public", | |
| // and then it quickly escalated into more and more evil suggestions. | |
| // I've tried to capture interesting suggestions here. | |
| // | |
| // Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_, | |
| // @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant, |
| #!/usr/bin/env python | |
| import sys | |
| import argparse | |
| import networkx as nx | |
| import community | |
| from networkx.readwrite import json_graph | |
| def graphmltojson(graphfile, outfile): |
| David Heinemeier | |
| Gihub: | |
| • 14 repos related to Ruby | |
| • multiple comments in rails/rails | |
| RubyGem | |
| • 23 Gems | |
| • 227,964,383 downloads | |
| Vimeo | |
| • Uploaded RubyConf video | |
| 37Signals |
Command Line
pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)pry -r ./config/environment.rb - load your rails into a pry sessionDebugger
| # Using these pry gems -- copy to your Gemfile | |
| # group :development, :test do | |
| # gem 'awesome_print' # pretty print ruby objects | |
| # gem 'pry' # Console with powerful introspection capabilities | |
| # gem 'pry-byebug' # Integrates pry with byebug | |
| # gem 'pry-doc' # Provide MRI Core documentation | |
| # gem 'pry-rails' # Causes rails console to open pry. `DISABLE_PRY_RAILS=1 rails c` can still open with IRB | |
| # gem 'pry-rescue' # Start a pry session whenever something goes wrong. | |
| # gem 'pry-theme' # An easy way to customize Pry colors via theme files | |
| # end |
| >>> import itertools | |
| >>> import string | |
| >>> from elasticsearch import Elasticsearch,helpers | |
| es = Elasticsearch() | |
| >>> # k is a generator expression that produces | |
| ... # a series of dictionaries containing test data. | |
| ... # The test data are just letter permutations | |
| ... # created with itertools.permutations. | |
| ... # | |
| ... # We then reference k as the iterator that's |
Tested with Apache Spark 2.1.0, Python 2.7.13 and Java 1.8.0_112
For older versions of Spark and ipython, please, see also previous version of text.
I was reading ["Clojure is for Type B Personalities"][2] and it sparked some thoughts I had about the intersection of western philosophy and programming.
One could say Mathematics is an extension of Epistemology. And all theory about computability are an extension of mathematics. I reckon how one thinks about computability and how one writes computable functions are a reflection of a person's natural epistemological tendencies. This is going to be just as unscientific as ["Clojure is for Type B Personalities"][2], but hopefully another
Fast/efficient approach:
-- execute("UPDATE posts SET comments_count = (SELECT count(1) FROM comments WHERE comments.post_id = posts.id)")
-> 1.3197s
Slow/naïve approach:
| SPC s c remove highlight | |
| **** Files manipulations key bindings | |
| Files manipulation commands (start with ~f~): | |
| | Key Binding | Description | | |
| |-------------+----------------------------------------------------------------| | |
| | ~SPC f c~ | copy current file to a different location | | |
| | ~SPC f C d~ | convert file from unix to dos encoding | | |
| | ~SPC f C u~ | convert file from dos to unix encoding | |