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 contains various tips and tricks for wordpress management and development |
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
loop(Req, DocRoot) -> | |
Mod = ewgi_mochiweb:new(fun ?MODULE:simple_stack/1), | |
Mod:run(Req). | |
simple_stack(Ctx) -> | |
to_upper(hello_app(Ctx)). | |
hello_app({ewgi_context, Request, _Response}) -> | |
ResponseHeaders = [{"Content-type", "text/plain"}], |
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
#All calls to urls under /dbs are proxyed to couchdb | |
# eg. a call to http://example.com/dbs/mydb becomes http://localhost:5984/mydb | |
location /dbs { | |
rewrite /dbs/(.*) /$1 break; | |
proxy_pass http://localhost:5984; | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
} |
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 accept_languages(browser_pref_langs): | |
"""Parses the request and return language list. | |
browser_pref_langs is the plain Accept-Language http request header | |
value. | |
Stolen from Products.PloneLanguageTool, under GPL (c) Plone Foundation, | |
slightly modified. | |
Taken from tweetengine http://github.com/Arachnid/tweetengine/ | |
""" | |
browser_pref_langs = browser_pref_langs.split(',') | |
i = 0 |
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
<?php | |
// We'll be outputting a PDF | |
header('Content-type: application/pdf'); | |
// and It will be called downloaded.pdf | |
header('Content-Disposition: attachment; filename="downloaded.pdf"'); | |
// The PDF source is in original.pdf | |
readfile('original.pdf'); | |
?> |
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
# | |
# Wide-open CORS config for nginx | |
# | |
location / { | |
if ($request_method = 'OPTIONS') { | |
add_header 'Access-Control-Allow-Origin' 'http://10.140.10.40'; | |
# |
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
/* See also: "Learning Javascript Design Patterns" by Addy Osmani | |
* http://addyosmani.com/resources/essentialjsdesignpatterns/book/ | |
* | |
* for examples on how to use pubsub as event aggregator (Mediator) | |
* | |
*/ | |
var pubsub = {}; | |
(function(q) { | |
var topics = {}, subUid = -1; | |
q.subscribe = function(topic, func) { |
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
# In case of unicode decoding errors in Python 2.7 we can fix with an ugly hack: | |
# file Compiler.py row 1579 wrap the line: | |
source = unicode(source) | |
# in a try that intercepts the error and returns the template unchanged | |
try: | |
source = unicode(source) | |
except UnicodeDecodeError: |
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 re-enables ssh-dss on Fedora 23... until I change all the keys | |
PubkeyAcceptedKeyTypes +ssh-dss | |
#add to .ssh/config | |
Host * | |
ControlPersist yes | |
ControlMaster auto | |
ControlPath /tmp/ssh-%r@%h:%p | |
ServerAliveInterval 60 |
OlderNewer