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
Ubuntu 11.04 | |
zsh | |
--shell loads | |
/home/qx/.rvm/scripts/initialize:43: bad pattern: (/home/qx/.bash_profile | |
/home/qx/.rvm/scripts/initialize:43: bad pattern: (/home/qx/.bash_profile | |
% ➜ ~ rvm -v | 8:53:11 | | |
/home/qx/.rvm/scripts/initialize:43: bad pattern: (/home/qx/.bash_profile | |
rvm 1.6.25 by Wayne E. Seguin ([email protected]) [https://rvm.beginrescueend.com/] |
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
``` | |
class Ticket | |
include DataMapper::Resource | |
if Rails::DataMapper.configuration.repositories["development" || "test" || "production"]["ticketengine"] | |
def self.default_repository_name | |
:ticketengine | |
end | |
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
from flask import get_template_attribute | |
from jinja2 import Template | |
class MacroFor(object): | |
""" Use this as a mixin | |
e.g. | |
class ListItemBasic(MacroFor): | |
def __init__(self, listitem): | |
self.title = listitem.title |
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
class InternalMacro(object): | |
Manipulates or creates a macro given a name, macro text, and type of content to fill(is_tuple, is_dict, is_list, is_file). | |
Set content_is to 'passthrough' and kwarg 'to_pass' to move "something else" through this (useful where you | |
need to mix "something else" with internal macros for this a use case of this class, e.g. internally collating varied | |
aggregations of macros dependent on varied states or permissions | |
def __init__(self, name = None, | |
text = None, |
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
def app_info(app): | |
''' information about your flask application''' | |
import pprint | |
pp = pprint.PrettyPrinter(indent=4) | |
config_list = [] | |
for k, v in app.config.iteritems(): | |
config_list.append("{}: {}".format(k, v)) | |
pp.pprint(config_list) | |
map_list = [] | |
for i in app.url_map.iter_rules(): |
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
def topbar_pack(current_user): | |
if current_user.get_id(): | |
nav_pack = nav_in_pack() | |
user_pack = user_in_pack() | |
else: | |
nav_pack = nav_out_pack() | |
user_pack = user_out_pack() | |
tp = get_template_attribute('macros/topbar.html', 'topbar') | |
return tp(nav_pack, user_pack, current_user) |
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("awful") | |
default_search_modes = { | |
i = {prompt="IMDB", search="https://imdb.com/"}, | |
w = {prompt="Wikipedia", search="https://wikipedia.com/"}, | |
g = {prompt="Google", search="https://google.com/"}, | |
} | |
local function create_wbox() | |
wbox = awful.wibox({ position = "bottom", ontop = true, screen = mouse.screen }) |
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
""" | |
This gist provides several mixins to be used on any number of sqlachemy models | |
1. HasLogMixin, provides a list EntityLog items specific and attached to an instance of the class | |
2. IsActor or IsReceiver mixins that allow the class to be related to an EntityLog item | |
as an actor or receiver | |
The ideal goal is EntityLog items, relatable to specific instances, and queryable by actor/receiver | |
attachable to any number of items with mixins. |
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
package main | |
import ( | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"os" | |
"runtime" | |
"testing" |
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 <cmath> | |
#include <stdio.h> | |
#include <iostream> | |
#include "table.h" | |
bool Cubic::operator==(const Cubic& o) const { | |
return (X == o.X && Y == o.Y && Z == o.Z); | |
} | |
Cubic Cubic::operator+(const Cubic& o) const { |
OlderNewer