rails new blog
cd blog
hanami new bookshelf
vim Gemfile # add `hanami`
bundle
vim bookshelf/config/environment.rb # See Note 1
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 |
def sua_view(): | |
qs = SeuModel.objects.all() | |
data = [] | |
for object in qs: | |
data.append({ | |
'nome': object.nome, | |
'idade': object.idade.strftime("%d/%m/%Y"), # objeto do tipo datetime | |
'produtos': object.produtos.values_list('id', 'descricao'), # objeto do tipo foreignkey com o model Produto | |
}) | |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"
A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.
I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.
I'd love comments and suggestions about any of these.
I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.
I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".
Copy this gist and customise it to your liking.
- Run Brakeman and resolve any issues where required
- Run rails best practices and resolve any warnings
- Run full test suite and make sure all tests are passing
- Make sure no dummy email addresses are left in any notification emails (eg contact form)
- Make sure production assets compile correct (eg files in vendor, etc, compile and are not 404'ing in production environment)
- If using unicorn in production, make sure deploys are restarting the unicorns
class SomeORM | |
def self.attributes(*names) | |
if const_defined?(:DynamicAttributes, false) | |
mod = const_get(:DynamicAttributes) | |
else | |
mod = const_set(:DynamicAttributes, Module.new) | |
include mod | |
end | |
mod.module_eval do | |
names.each do |name| |
/** | |
* Test Instance/Class Methods on an Account Model | |
*/ | |
var assert = require('assert'), | |
Utils = require('../../support/utils'), | |
Database = require('../../support/database'); | |
describe('Account', function() { |
[global_config] | |
title_transmit_bg_color = "#4c4c4c" | |
title_inactive_fg_color = "#afafaf" | |
title_inactive_bg_color = "#2d2d2d" | |
[keybindings] | |
copy = <Primary>c | |
paste = <Primary>v | |
[profiles] | |
[[default]] | |
palette = "#000000:#f92672:#6cc72c:#fe9720:#5f91ef:#9358fe:#36af90:#8c8c8c:#4c4c4c:#ff80f4:#a7e22e:#ffee99:#5fd9ef:#ae82fe:#66efd5:#c7cece" |