Every programming language has some kind of way of doing numbers and math. Do not worry, programmers lie frequently about being math geniuses when they really aren’t. If they were math geniuses, they would be doing math, not writing ads and social network games to steal people’s money.
This file contains 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 | |
$list_to_check = array( | |
array(2,2), | |
array(2,3), | |
array(3,3), | |
array(3,2) | |
); | |
// var_dump($list_to_check); |
This file contains 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
RUBY_VERSION=1.9.3 | |
APP_NAME=that_great_app | |
rvm $RUBY_VERSION@$APP_NAME --create && gem install rails --no-ri --no-rdoc && rails new $APP_NAME -d mysql && echo "rvm $RUBY_VERSION@$APP_NAME" > $APP_NAME/.rvmrc && echo ".rvmrc" >> $APP_NAME/.gitignore |
This file contains 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
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011 | |
* http://benalman.com/ | |
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */ | |
(function($) { | |
var o = $({}); | |
$.subscribe = function() { | |
o.on.apply(o, arguments); |
This file contains 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
ActiveAdmin.register Category do | |
extend CollectiveIdea::Acts::NestedSet::Helper | |
form do |f| | |
f.inputs do | |
f.input :name | |
f.input :parent_id, :as => :select, :collection => (nested_set_options(Category, @category) {|i, level| "#{'-' * level} #{i.name}" }) | |
end | |
f.buttons | |
end |
This file contains 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
$ mysql -u root -p | |
Enter password: # <= but, this will be the last time | |
mysql> SET PASSWORD FOR root@localhost=PASSWORD(''); | |
Query OK, 0 rows affected (0.00 sec) | |
mysql> exit | |
bye | |
$ mysql -u root # with no password, cause I know what i'm doing. |
- it talks to the database
- it communicates across the network
- it touches the file system
- it can’t run at the same time as any of your other unit tests
- you have to do special things to your environment (such as editing config files) to run it Tests that do these things aren’t bad. Often they are worth writing, and they can be written in a unit test harness. However, it is important to keep them separate from true unit tests so that we can run the unit tests quickly whenever we make changes.
--
This file contains 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 rake { | |
if [ -e Gemfile ]; then | |
bundle exec rake $@ | |
else | |
`which rake` $@ | |
fi | |
} |
This file contains 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
require 'logger' | |
class String | |
LOGGER = Logger.new($stderr) | |
def -@; LOGGER.info self; end | |
end | |
# Extracted earlier, hardcoded for speed | |
ENTITIES = %w(I-ORG O I-MISC I-PER I-LOC B-LOC B-MISC MO B-ORG) |
diretor da 3M: A gente precisa melhorar as vendas destes adesivos reposicionáveis.
Marketeiro: Já falei, ninguém compra "adesivos reposicionáveis", a gente precisa de um nome bom. Um que marca, um que seja uma ordem para usar isso.
Estagiário: Isso é um conceito muito bom, posso postar isso no meu blog?
Marketeiro: Vamos chamar de Post-It, olha grande idéia essa: Post-It. Fixa, vai pegar.
Diretor da 3M: Você deu uma ótima idéia para o nome, mas eu ainda não vejo muito uso, não podemos gastar muito nessa campanha com um produto que não vai dar retorno.