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 grow_field(field){ | |
var field = $(field) | |
setTimeout(function(){ | |
var temp_field | |
if (field.hasClass('.note')) temp_field = $('.autogrow .note' ) | |
else temp_field = $('.autogrow .title') | |
temp_field.text(field.val() + " MM") | |
field.css('height', temp_field.height()) | |
}) | |
} |
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 renderer(template, args, encoding=None): | |
return template + ": "+ args['body'] | |
class Resource(resource.Resource): | |
@resource.child("foo") | |
def foo(self, request, segments): | |
method_name = "foo_"+request.method.lower() | |
if request.method == "HEAD" and not hasattr(self, method_name): | |
method_name = "foo_get" | |
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
npm WARN Building the local index for the first time, please be patient | |
npm http GET https://registry.npmjs.org/-/all | |
npm http 200 https://registry.npmjs.org/-/all | |
npm ERR! Error: ENOENT, open '/home/nick/.npm/-/all/.cache.json' | |
npm ERR! { [Error: ENOENT, open '/home/nick/.npm/-/all/.cache.json'] | |
npm ERR! errno: 34, | |
npm ERR! code: 'ENOENT', | |
npm ERR! path: '/home/nick/.npm/-/all/.cache.json' } | |
npm ERR! You may report this log at: | |
npm ERR! <http://github.com/isaacs/npm/issues> |
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
module = angular.module 'ui.directive' | |
module.directive 'virtualRepeat', -> | |
transclude: true | |
compile: (element, attributes, linker) -> | |
(scope, element, attributes, controller) -> | |
expression = attributes.virtualRepeat | |
match = expression.match(/^\s*(.+)\s+in\s+(.*)\s*$/) | |
if not match then throw Error "Expected virtualRepeat in form of '_item_ in _collection_' but got '#{expression}'." | |
[throwaway, key, value] = match |
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
<div ng-switch="!!$root.show_this_dialog"> | |
<section ng-switch-when="true" class="overlay" centerline ng-click="$root.show_this_dialog = false"> | |
<div class="dialog" ng-click="$event.stopPropagation()"> | |
<header class="header"> | |
<h1>I'm a Dialog</h2> | |
<a class="close" ng-click="$root.show_this_dialog = false">x</a> | |
</header> | |
</div> | |
</section> | |
</div> |
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
Nicholass-MacBook-Air-5:test-git nick$ git init | |
Initialized empty Git repository in /Users/nick/test-git/.git/ | |
Nicholass-MacBook-Air-5:test-git nick$ touch file | |
Nicholass-MacBook-Air-5:test-git nick$ git add file | |
Nicholass-MacBook-Air-5:test-git nick$ git commit -am "first commit" | |
[master (root-commit) dd1c9fd] first commit | |
0 files changed | |
create mode 100644 file | |
Nicholass-MacBook-Air-5:test-git nick$ git checkout -b branch1 | |
Switched to a new branch 'branch1' |
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
Requirements: Postgresql, Flask-Admin, Flask-Sqlalchemy | |
How to run it: | |
createdb inline_bug | |
psql inline_bug -af schema.sql | |
python app.py | |
Go to /admin and try to edit the servers. One will work, one will not. |
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
2013-12-06 10:56:05,034 INFO sqlalchemy.engine.base.Engine BEGIN (implicit) | |
2013-12-06 10:56:05,035 INFO sqlalchemy.engine.base.Engine SELECT users.id AS users_id, users.email AS users_email, users.password AS users_password, users.active AS users_active, users.confirmed_at AS users_confirmed_at, users.last_login_at AS users_last_login_at, users.current_login_at AS users_current_login_at, users.last_login_ip AS users_last_login_ip, users.current_login_ip AS users_current_login_ip, users.login_count AS users_login_count, users.first_name AS users_first_name, users.last_name AS users_last_name | |
FROM users | |
WHERE users.id = %(id_1)s | |
LIMIT %(param_1)s | |
2013-12-06 10:56:05,035 INFO sqlalchemy.engine.base.Engine {'id_1': u'bada4c26-7571-4f96-9d46-5ae511eed682', 'param_1': 1} | |
2013-12-06 10:56:05,037 INFO sqlalchemy.engine.base.Engine SELECT roles.id AS roles_id, roles.name AS roles_name, roles.description AS roles_description | |
FROM roles, roles_users | |
WHERE %(param_1)s = roles_users.user_id AND roles.id = roles_users.ro |
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.ext.wtf import Form | |
import wtforms as w | |
import wtforms.validators as wv | |
from flask import Flask, request, jsonify | |
app = Flask(__name__) | |
class MyForm(Form): | |
name = w.StringField(validators=[wv.DataRequired()]) |
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 maybe_super(cls, self, method_name, base_value=None): | |
""" Call the super method if it exists. | |
Use it like this: | |
def some_method(self, *args, **kwargs): | |
result = maybe_super(MyClass, self, 'some_method')(*args, **kwargs) | |
""" | |
sup = super(cls, self) |
OlderNewer