| { | |
| "auto_match_enabled": false, | |
| "binary_file_patterns": | |
| [ | |
| "*.jpg", | |
| "*.jpeg", | |
| "*.png", | |
| "*.gif", | |
| "*.ttf", | |
| "*.tga", |
| AllCops: | |
| RunRailsCops: true | |
| # Commonly used screens these days easily fit more than 80 characters. | |
| Metrics/LineLength: | |
| Max: 120 | |
| # Too short methods lead to extraction of single-use methods, which can make | |
| # the code easier to read (by naming things), but can also clutter the class | |
| Metrics/MethodLength: |
| # Put this in ~/.nvim/pythonx/ | |
| # requires python, see :he nvim-python | |
| from threading import Thread | |
| from time import sleep, strftime | |
| class EventLoop(Thread): | |
| def __init__(self, vim): | |
| super(EventLoop, self).__init__() | |
| self.vim = vim |
Some thoughts on using node-postgres in a web application
This is the approach I've been using for the past year or so. I'm sure I'll change and it will change as I grow & am exposed to more ideas, but it's worked alright for me so far.
I would definitely use a single pool of clients throughout the application. node-postgres ships with a pool implementation that has always met my needs, but it's also fine to just use the require('pg').Client prototype and implement your own pool if you know what you're doing & have some custom requirements on the pool.
| # Elixir has pipes `|>`. Let's try to implement those in Ruby. | |
| # | |
| # I want to write this: | |
| # | |
| # email.body | RemoveSignature | HighlightMentions | :html_safe | |
| # | |
| # instead of: | |
| # | |
| # HighlightMentions.call(RemoveSignature.call(email.body)).html_safe | |
| # |
| # require 'spec_helper' | |
| class InMemoryArel | |
| attr_accessor :collection | |
| def initialize(collection) | |
| self.collection = collection | |
| end | |
| def all |
| // assertions/compareScreenshot.js | |
| var resemble = require('resemble'), | |
| fs = require('fs'); | |
| exports.assertion = function(filename, expected) { | |
| var screenshotPath = 'test/screenshots/', | |
| baselinePath = screenshotPath + 'baseline/' + filename, | |
| resultPath = screenshotPath + 'results/' + filename, | |
| diffPath = screenshotPath + 'diffs/' + filename; |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| # Updated for Ruby 2.3 | |
| string_t = None | |
| def get_rstring(addr): | |
| s = addr.cast(string_t.pointer()) | |
| if s['basic']['flags'] & (1 << 13): | |
| return s['as']['heap']['ptr'].string() | |
| else: | |
| return s['as']['ary'].string() |