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
app.factory('CampaignAccount', ['$scope', '$resource', function($scope, $resource) { | |
return $resource('/campaign_accounts/:id', { | |
id: '@id' | |
}, { | |
update: { | |
method: 'PATCH' | |
} | |
}); | |
}]); |
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
<?php | |
$agents = "/(sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera mini|IEmobile|DoCoMo|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox|blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-|ipad|ipod|iphone|portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc|smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|mobile safari|android)/i"; | |
$accepts = "/(text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml)/i"; | |
if(preg_match($agents,$_SERVER['HTTP_USER_AGENT'])||preg_match($accepts,$_SERVER['HTTP_ACCEPT'])){ | |
header("Location: mobile"); | |
} | |
?> |
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
###################################################### | |
# Redirect to separate directory for mobile site | |
###################################################### | |
# Don't redirect if we're already there! | |
RewriteCond %{REQUEST_URI} !^/mobile/.*$ | |
# Check Cookie to (en|dis)able redirect to mobile or stay on desktop | |
RewriteCond %{HTTP_COOKIE} !^.*mobile.*$ [NC] |
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
class Form(web.form.Form, object): | |
def __init__(self, name, *inputs, **kw): | |
super(Form, self).__init__(*inputs, **kw) | |
self.name = name | |
def save_state(self): | |
session.forms[self.name] = dict( | |
notes = dict((i.name, i.note) for i in self.inputs if i.note ), | |
values = dict((i.name, i.get_value()) for i in self.inputs ), |
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
import web | |
from controllers import blog | |
urls = ( | |
'/blog', blog.app | |
) | |
app = web.application(urls, locals()) | |
if __name__ == "__main__": |