This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CostsByJobData(object): | |
def __init__(self, user_id, progress): | |
self.user_id = user_id | |
self.progress = progress | |
def declare_progress_steps(self): | |
total_jobs = len(JobRepository.by_user(self.user_id)) | |
self.progress.add_progress_steps(total_jobs) | |
return self | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sheet(object): | |
def __init__(self, name, main_header, data_headers, data): | |
self.name = name | |
self.main_header = main_header | |
self.data_headers = data_headers | |
self.data = data | |
def dump_to(self, document): | |
spreadsheet = document.add_spreadsheet(self.name) | |
self.main_header.dump_to(spreadsheet) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using a hash | |
def classes_for(path) | |
classes = { | |
'facilities' => %w(instalaciones listado), | |
'offers' => %w(oferta academica), | |
'teachers' => %w(claustro), | |
'news' => %w(actualidad), | |
'agenda' => %w(actualidad) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts = "it's a kind of magic" | |
puts puts | |
> it's a kind of magic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://vimeo.com/80533536 | |
# Integrated tests | |
## What's an integrated test? | |
A test that when it fails, you cannot point where it failed. | |
Test pyramid is a good advice. But it doesn't make clear that the integrated tests are a SCAM. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prereqs: | |
# * Ruby | |
# * gem install watchr | |
# Usage: | |
# copy autounit to php project directory | |
# run watchr autounit | |
watch('src/(.*)\.php') do |md| | |
puts "\e[H\e[2J" #clear console |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Trait SomeTrait | |
{ | |
} | |
class A | |
{ | |
use SomeTrait; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* PHP VERSION: PHP 5.5.4-1 | |
*/ | |
// Raises a parse error | |
null['unexisting']; | |
// Returns null | |
$null_value = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function run(url) { | |
var match = /(youtube|vimeo|confreaks)\.com/.exec(url); | |
if (match) { | |
return match[1]; | |
} | |
return 'unknown'; | |
} |