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
| use 5.20.0; | |
| package Foo; | |
| use Moose; | |
| use Time::HiRes qw[gettimeofday tv_interval ITIMER_VIRTUAL setitimer getitimer]; | |
| with 'MooseX::Role::Timer'; | |
| use UUID::Tiny ':std'; | |
| use namespace::clean; | |
| has 'transaction_id' => (is => 'ro', isa => 'Str', builder => '_build_transaction_id'); |
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
| import functools | |
| def dec(f): | |
| @functools.wraps(f) | |
| def w(*args, **kwargs): | |
| # print 'apples' if called a method to an instance | |
| # print 'oranges' if called as a function even if first argument is an object | |
| # if called as a method 'bar' object is args[1] | |
| # if called as a function 'bar' object is args[0] | |
| return f(*args, **kwargs) |
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
| get '' => sub { | |
| my $all = param('all') | |
| my $tag = param('tag') || 'es'; | |
| my $sql = qw[ select subnet from network where circuit_id=? AND tag_id=5 ]; | |
| $sql .= $all? '' : "AND state='active'" | |
| } |
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
| from nose.tools import * | |
| from pdb import set_trace | |
| class Frame(object): | |
| def __init__(self, first=0, second=0): | |
| self.first = int(first) | |
| self.second = int(second) | |
| self.value = int(first) + int(second) | |
| self.__next = None |
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
| docker run ubuntu /bin/bash -c 'apt-get update 2>&1 >/dev/null && hostname' | docker commit $(xargs) ubuntu:latest |
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
| import rom | |
| import rom.util | |
| import logging | |
| from rq import SimpleWorker, Queue | |
| from redis import Redis | |
| logging.disable(logging.CRITICAL) | |
| class ExampleClass(rom.Model): |
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
| use strict; | |
| use warnings; | |
| use 5.16.0; | |
| use Test::More; | |
| use Carp::Always; | |
| our $TEST_STRING = 'this is a test'; | |
| package main; |
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
| use strict; | |
| use warnings; | |
| use 5.16.0; | |
| use Test::More; | |
| use Carp::Always; | |
| our $TEST_STRING = 'this is a test'; | |
| package main; |
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
| harlie:tmp.QVgwdIM45p$ cat a.tt | |
| [%- INCLUDE 'b.tt' -%] | |
| a.tt: I am at the bottom | |
| charlie:tmp.QVgwdIM45p$ cat b.tt | |
| b.tt: I am at the top | |
| charlie:tmp.QVgwdIM45p$ tpage a.tt | |
| b.tt: I am at the top | |
| a.tt: I am at the bottom | |
| charlie:tmp.QVgwdIM45p$ |
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
| # Which statement looks most like the english sentence below? | |
| # Peter, go to the kitchen, get some eggs, make an omelette | |
| # this? | |
| peter.go_to_the_kitchen.get_some_eggs.make_an_omelette() | |
| # or this? | |
| peter.goToTheKitchen.getSomeEggs.makeAnOmelette() |
NewerOlder