Skip to content

Instantly share code, notes, and snippets.

Mikhail P mihasya

Block or report user

Report or block mihasya

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mihasya
mihasya / after
Created Jan 2, 2013
Debug info about SecurityException when using mvn exec:java
View after
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:compile
...
[INFO] +- com.yammer.dropwizard:dropwizard-core:jar:0.6.1:compile
[INFO] | +- com.sun.jersey:jersey-core:jar:1.15:compile
[INFO] | +- com.sun.jersey:jersey-server:jar:1.15:compile
[INFO] | | \- asm:asm:jar:3.1:compile
[INFO] | +- com.sun.jersey:jersey-servlet:jar:1.15:compile
[INFO] | +- com.yammer.metrics:metrics-core:jar:2.2.0:compile
[INFO] | +- com.yammer.metrics:metrics-servlet:jar:2.2.0:compile
[INFO] | +- com.yammer.metrics:metrics-jetty:jar:2.2.0:compile
View context_processors.py
#make some settings accessible via settings.FOO from within templates
from django.conf import settings
def exposed_settings(request):
context_settings = dict()
for x in settings.TEMPLATE_CONTEXT_SETTINGS:
context_settings[x] = getattr(settings, x)
return { 'settings': context_settings }
View form_sluggify.py
#Copyright (c) 2009 Mikhail Panchenko
#MIT License http://www.opensource.org/licenses/mit-license.php
class AddBmarkForm(forms.Form):
name = forms.CharField(max_length=50, required=False)
description = forms.CharField(max_length=255, required=True)
def clean_description(self):
desc = self.cleaned_data['description']
name = slugify(desc).decode()
View appEngineUserRequired.py
#Copyright (c) 2009 Mikhail Panchenko
#MIT License http://www.opensource.org/licenses/mit-license.php
def userRequired(fn):
"""decorator for forcing a login"""
def new(*args, **kws):
user = users.get_current_user()
if not (user):
r = args[0]
return HttpResponseRedirect(users.create_login_url(
View request_param_pseudo.php
<?php
$argsToPass = array();
$args = ReflectionMethod->getParams();
/*you got an array of param names in the order they appear in the method signature */
foreach ($args as $arg) {
if (!isset($_REQUEST[$arg])) { //check if the arg is optional and fail if not }
$argsToPass[] = $_REQUEST[$arg];
}
$ReflectionMethod->invoke($argsToPass);
?>
You can’t perform that action at this time.