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
collection = some_method_return() | |
filtered = [] | |
for item in collection: | |
if item.property + item.another > 10: | |
filtered.append(item) | |
return filtered.sort() |
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
From(collection) | |
.where("item.property + item.value > 10") | |
.order_by("item.some_order_property") | |
.select_many() | |
# this returns an ordered collectin with only the items that | |
# have the sum of property and value greater than 10 |
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
From(collection) | |
.where("item.some_boolean or (item.other_boolean and item.another_boolean)") | |
.order_by("item.some_order_property") | |
.select("name","age","sex","salary") | |
# This query returns a new collection transformed from the original. | |
# The items in this new collection are from a class called | |
# Dynamic_Item and feature only the four selected properties, | |
# instead of all the properties of the original items in 'collection'. | |
# The where clause is observed as well, since only the items that |
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
From(collection) | |
.select("name","age","sex","salary","salary + bonus") | |
# This query returns the evaluated return of salary + bonus | |
# as dynamic_4. This is really useful to perform calculations | |
# on the fly. |
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
From(collection) | |
.order_by("-(salary + bonus)") | |
.select("name","age","sex","salary","salary + bonus") | |
# This query returns the evaluated return of salary + bonus | |
# as dynamic_4 and sorts through this expression in desc order. |
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
#!/usr/bin/ruby | |
# | |
# I deliberately didn't DRY /usr/local references into a variable as this | |
# script will not "just work" if you change the destination directory. However | |
# please feel free to fork it and make that possible. | |
# | |
# If you do fork, please ensure you add a comment here that explains what the | |
# changes are intended to do and how well you tested them. | |
# | |
# 30th March 2010: |
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
export TERM="xterm-color" | |
export EDITOR='mate -w' | |
export CLICOLOR=1 | |
alias ls="ls -G" | |
PS1="\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] " | |
alias egrep="egrep --colour" | |
alias grep="egrep --colour" | |
export PYTHONPATH=$PYTHONPATH:$HOME/usr/python-libs | |
export PATH=$PATH:$HOME/usr/bin | |
export GEM_HOME='/usr/local/Cellar/gems/1.8' |
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
✗ Should equal regular http get | |
Expected body of /home/heynemann/dev/thumbor/vows/fixtures/conselheira_tutelar.jpg to match topic, but it didn't | |
Traceback (most recent call last): | |
File "/home/heynemann/.virtualenvs/home/lib/python2.6/site-packages/pyvows/runner.py", line 113, in async_run_vow | |
result = member(context_instance, topic) | |
File "/home/heynemann/dev/thumbor/vows/http_loader_vows.py", line 76, in should_equal_regular_http_get | |
expect(topic).to_match_contents_of(fixture_for('conselheira_tutelar.jpg')) | |
File "/home/heynemann/.virtualenvs/home/lib/python2.6/site-packages/pyvows/core.py", line 50, in assert_topic | |
return getattr(Vows.Assert, method_name)(self.topic, *args, **kw) |
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
Server Software: | |
Server Hostname: 127.0.0.1 | |
Server Port: 8888 | |
Document Path: /healthcheck | |
Document Length: 7 bytes | |
Concurrency Level: 50 | |
Time taken for tests: 19.028 seconds | |
Complete requests: 100000 |
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
#include <event.h> | |
#include <evhttp.h> | |
#include <cstdio> | |
#include <iostream> | |
#define SRVR_SIGNATURE "dirq v 0.0.1" | |
void router(struct evhttp_request *r, void *arg) { | |
// just testing retrieval of URI | |
const char *uri = evhttp_request_uri(r); |
OlderNewer