This file contains hidden or 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 django.core.management.base import BaseCommand | |
from django.conf import settings | |
from incuna.structure.models import Page as StructurePage | |
from feincms.module.page.models import Page as FeinPage | |
from feincms.content.richtext.models import RichTextContent | |
def migrate_pages(structure_pages, template, region, parent=None, **options): | |
""" | |
Migrate the structure pages and their children (recursively) | |
""" |
This file contains hidden or 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
# Convert Trac wiki to Markdown | |
# Based in https://gist.github.com/619537/94091aa59bdf6d6e5ad2fbb063465b2d160156ad | |
# | |
# | |
################################################################################ | |
# Single line code snippets | |
# {{{XXX}}} | |
# ==> | |
# `XXX` | |
# sed -i '' -Ee 's/{{{(.*)}}}/`\2`/' $@ |
This file contains hidden or 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
[enter] | |
~ | |
. |
This file contains hidden or 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
#!/bin/bash | |
display_usage() { | |
echo -e "\nUsage: $0 [command] \n" | |
echo -e "Execute the specified command with environment variables set." | |
echo -e "If no command is specified then execute a new shell.\n" | |
} | |
if [[ ( $1 == "--help") || $1 == "-h" ]]; then | |
display_usage |
This file contains hidden or 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
exports.repositories = [ | |
{ | |
url: "https://USERNAME:[email protected]/DATABASE", | |
search: "https://USERNAME:[email protected]/DATABASE/_design/lucene/_search/jam" | |
}, | |
"http://jamjs.org/repository" | |
]; |
This file contains hidden or 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
# Replace `lib/edetail` with `edetail` | |
grep -rl 'lib/edetail' project | xargs sed -i '' -e "s|[\"']lib/edetail/\(.*\)[\"']|'edetail/\1'|" | |
# Replace `underscore` with `lodash` | |
grep -rl 'lib/require-underscore/wrapper' project | xargs sed -i '' -e "s|[\"']lib/require-underscore/wrapper[\"']|'lodash'|" | |
# Replace `backbone` with `backbone-zepto` | |
grep -rl 'lib/require-backbone/wrapper' project | xargs sed -i '' -e "s|[\"']lib/require-backbone/wrapper[\"']|'backbone-zepto'|" | |
# Replace `zepto` plugins |
This file contains hidden or 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
for file in $(shopt -s nullglob; echo screenshots/*.jpg); do | |
echo convert "$file" -resize 200x150 "${file%%.*}-thumb.${file##*.}"; | |
cp "$file" "${file%%.*}-full.${file##*.}"; | |
convert "$file" -resize 200x150 "${file%%.*}-thumb.${file##*.}"; | |
done; |
This file contains hidden or 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
// The Veeva API can only accept one call at a time | |
// A queue is used to avoid calling the API while a call is in progress. | |
var Queue = (function () { | |
var queue = []; | |
var empty = true; | |
return { | |
// Add a function to the queue | |
// (it will be called immediately if the queue is empty) | |
push: function (fn) { | |
queue.push(fn); |
This file contains hidden or 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
// The Veeva API can only accept one call at a time. | |
// A queue is used to avoid calling the API while an earlier call is in progress. | |
var Queue = (function () { | |
var queue = []; | |
var empty = true; | |
return { | |
// Add a function to the queue | |
// (it will be called immediately if the queue is empty) | |
push: function (fn) { | |
queue.push(fn); |
This file contains hidden or 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
# Split key messages data | |
awk -F "\",\"" '{print $3 " " substr(substr($4, 0, match($4, /.zip/)-1), 26)}' keymessages.csv | |
# sed | |
awk -F "\"*,\"*" '{print " -e \"s/keyMessageId: "substr(substr($4, 0, match($4, /.zip/)-1), 26)"/keyMessageId: "$3"/\"\\"}' keymessages.csv \ | |
| xargs -J % sed % -i '' project/data/slides.yaml |
OlderNewer