CLICK ME
yes, even hidden code blocks!
print("hello world!")| #!/usr/bin/env ruby | |
| # NOTE: this requires actually setting up a terminal profile called "Prod". | |
| # TODO i have no idea if this is good enough, sorry. | |
| def escape_for_applescript(string) | |
| string.gsub("\"", "\\\"") | |
| end | |
| def execute_applescript(applescript) |
| """ | |
| Logical deletion for Django models. Uses is_void flag | |
| to hide discarded items from queries. Overrides delete | |
| methods to set flag and soft-delete instead of removing | |
| rows from the database. | |
| """ | |
| from django.apps import apps | |
| from django.contrib.admin.utils import NestedObjects | |
| from django.db import models | |
| from django.db.models import signals |
| ###* | |
| # Bootstrap Datepicker for Backbone.Forms | |
| # | |
| # Quick editor to create a Bootstrap style datepicker (instead of multiple of dropdowns) | |
| # @see: https://github.com/eternicode/bootstrap-datepicker/ | |
| # @usage: takes 5 optional schema options: format, minViewMode, autoclose, clearBtn and endDate | |
| # Forked because I wanted to use only years as shown in the example below | |
| schema: | |
| MyDate: | |
| type: "DatePicker" |
| fs = require 'fs' | |
| # Structure of cache file: | |
| # | |
| # { | |
| # "path/to/output/file/1": { | |
| # "cache": { | |
| # "path/to/source/file/1": { | |
| # "size" : <file size>, | |
| # "mtime": <file modified time in ms>, |
| """ | |
| Credit to the parker library (https://github.com/coxmediagroup/parker/) and their TastyPieHandler. | |
| """ | |
| req = HttpRequest() | |
| resource = YourResource() | |
| bundle = resource.build_bundle(obj=your_model) | |
| bundle = resource.full_dehydrate(bundle) | |
| bundle = resource.alter_detail_data_to_serialize(req, bundle) |