Skip to content

Instantly share code, notes, and snippets.

@danielholmstrom
danielholmstrom / gist:5336594
Created April 8, 2013 12:55
Nose plugin for excluding files based on python version and filename
from nose.plugins import Plugin
class PyVersion(Plugin):
"""Nose plugin that excludes files based on python version and file name
If a filename has the format NAME.pyVERSION.py and VERSION doesn't match
[major][minor][micro], [major][minor] or [major] the file will be excluded
from tests.
#!/bin/bash
function a {
return "/$1"
}
function b {
print $1
}
b $(a "some_file")
<?php
/** Prepare a string for use with wordwrap by hyphenate words longer that $width
*
* Example:
* echo prep("1 12 123 1234 12345 123456 1234567 12345678", 4), PHP_EOL;
* Outputs:
* 1 12 123 123-4 123-45 123-456 123-4567 123-456-78
* XXX: DO NOT USE THIS UNLESS YOU KNOW YOU CAN(See for example preg_quote()).
*/
function prep($str, $width=72) {
node default {
Exec { path => "/bin:/usr/bin:/usr/local/bin" }
exec { "apt-get update": command => "apt-get update" }
package {'vim': ensure=>installed, }
#class { 'postgresql::server': } postgresql::server::db {'pluto_development': user => 'pluto', password => postgresql_password('pluto', 'plutopass'),}
{% with object.get_main_image_or_none as img %}
{% if img %}
<div class="img">
<a href="{% url 'view_object' object.gid %}"><img src="{{ img.image_thumbnail.url }}"></a>
</div>
{% endif %}
{% endwith %}
<?php
interface ExportLogger {
function info();
function debug();
function warning();
function error();
function fatal();
}
abstract class ExportMessage {
function __construct($type, $params) {
$this->_type = $type;
$this->_params = $params;
}
function getType() {
return $this->_type;
}
class NavisionSoapClient extends ExportClient {
}
class NavisionOrderFormatter extends ModelFormatter {
}
class NavisionOrderExportAdapter extends ExportAdapter {
}
create table made_export (
id int primary key,
type varchar(80) not null,
);
create table made_order_export (
id int primary key references made_export.id,
order_id int references order.id,
);
<?php
[
'price' => [
'retail' =>
[
'USD' => [
'type' => 'retail',
'currency' => 'USD',
'value' => 10,