Skip to content

Instantly share code, notes, and snippets.

@evaldasg
evaldasg / gist:9699e696ee732640844fd21d68b9d57b
Created August 5, 2016 05:50 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@evaldasg
evaldasg / dmginstall.sh
Created August 17, 2016 17:08 — forked from afgomez/dmginstall.sh
Download and install a .dmg
#!/bin/bash
# Downloads and install a .dmg from a URL
#
# Usage
# $ dmginstall [url]
#
# For example, for installing alfred.app
# $ dmginstall http://cachefly.alfredapp.com/alfred_1.3.1_261.dmg
#

source: https://gist.github.com/gaearon/ffd88b0e4f00b22c3159

The “purer” version is O(n2) where the original version is O(n), so it’s not the same as using for loops vs Array#reduce. Here’s a benchmark:

function mapValues1(obj, fn) {
  return Object.keys(obj).reduce((result, key) => {
    result[key] = fn(obj[key], key);
    return result;
 }, {});
@evaldasg
evaldasg / app-short.js
Created August 24, 2016 07:21 — forked from jshirley/app-short.js
Code for my loading strategy, documented at http://tech.tdp.me/2012/08/28/better-spa/
var YUI = require('yui').YUI,
Y = YUI(/* Your YUI Config */),
requireAuth = require('./lib/middlware/auth'),
modelLoader = require('./lib/middlware/loader'),
app = /* create express app */;
Y.namespace('TDP').config = {
webservices : global.config.webservices.path
};
@evaldasg
evaldasg / on-jsx.markdown
Created August 29, 2016 06:17 — forked from chantastic/on-jsx.markdown
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I lead the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can'

@evaldasg
evaldasg / rails http status codes
Created September 5, 2016 08:50 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@evaldasg
evaldasg / cuce.txt
Last active October 12, 2016 05:14
getting cucumber to work on macOS
install https://www.xquartz.org/index.html
brew install chromedrive
gem install cucumber
bundle exec rails s thin -d -p 3333 -P /tmp/main.pid -e cucumber
bundle exec cucumber features/
@evaldasg
evaldasg / to_gif.sh
Created April 19, 2017 12:04
create gif from mp4 screen record
ffmpeg -i screen01.mp4 -r 15 output.gif
@evaldasg
evaldasg / gist:f1f3c488f1b80ca233fb62a75ab3700e
Created May 18, 2017 06:54 — forked from alex-zige/gist:5795358
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views
git clone https://github.com/vim/vim.git
sudo apt-get install libncurses-dev
e ~/Downloads/vim/src % ./configure --prefix=/usr/local \ ✭ master ‹2.4.1›
--enable-gui=auto --without-x --disable-nls --enable-multibyte --with-tlib=ncurses --enable-pythoninterp --enable-rubyinterp --with-ruby-command=$(which ruby) --with-features=huge
make
sudo make install