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
namespace :db do | |
[ :migrate, :rollback ].each do |n| | |
namespace n do |migration_task| | |
original_task = migration_task.instance_variable_get("@scope").to_a.reverse.join ":" | |
[:with_sql, :to_sql ].each do |t| | |
desc "Run migration, and generated SQL" if t == :with_sql | |
desc "Generate migration SQL" if t == :to_sql |
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
import logging | |
import inspect | |
from dataclasses import dataclass, field | |
from typing import List, ClassVar | |
import pytest | |
logging.basicConfig(level=logging.DEBUG) | |
logger = logging.getLogger('rose') |
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
""" | |
A module to populate a DB schema using sqlalchemy for the problems on this webpage: | |
http://www.jitbit.com/news/181-jitbits-sql-interview-questions/ | |
Questions and my answers: | |
-- List employees (names) who have a bigger salary than their boss | |
select e.name from Employees as e | |
join Employees as b on e.BossId = b.EmployeeID | |
where e.Salary > b.Salary |
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
""" | |
An interactive HTTP server, starting a python debugger on each http request. | |
Set the value of "hr" to what you want the HTTP response to be, | |
and then type "c" to continue | |
Requires ipdb and bottle | |
""" | |
from bottle import * | |
import ipdb | |
@route('/favicon.ico') |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
import json | |
from functools import wraps | |
from flask import redirect, request, current_app | |
def support_jsonp(f): | |
"""Wraps JSONified output for JSONP""" | |
@wraps(f) | |
def decorated_function(*args, **kwargs): | |
callback = request.args.get('callback', False) | |
if callback: |
OlderNewer