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
class RegistrationFinalView(View): | |
#### | |
def get_token(self): | |
# TODO: Really need to double check of existence of token_key? | |
# Since this key has been checked by URLconf already. | |
token = self.kwargs.get('token_key', None) | |
if token in ['', None]: | |
raise Http404 | |
return token |
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
//////////////////////////////////////////////////////////////////////////////// | |
/// @file | |
//////////////////////////////////////////////////////////////////////////////// | |
#include <QtGui> | |
#include "fwe_evds.h" | |
#include "fwe_evds_object.h" | |
#include "fwe_evds_object_model.h" | |
using namespace EVDS; |
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
from functools import wraps | |
from django.core.exceptions import PermissionDenied | |
def superuser_required(method): | |
""" | |
Decorator to check whether user is super user or not | |
If user is not a super-user, it will raise PermissionDenied or | |
403 Forbidden. | |
""" |
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
=> ls | |
grub initramfs-linux-lts.img | |
initramfs-linux-fallback.img vmlinuz26 | |
initramfs-linux.img vmlinuz-linux | |
initramfs-linux-lts-fallback.img vmlinuz-linux-lts |
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
iptables -P INPUT ACCEPT | |
iptables -P FORWARD ACCEPT | |
iptables -P OUTPUT ACCEPT | |
iptables -t nat -F | |
iptables -t mangle -F | |
iptables -F | |
iptables -X | |
ip6tables -P INPUT ACCEPT | |
ip6tables -P FORWARD ACCEPT |
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
func Notify(logger *log.Logger) Adapter { | |
return func(h http.Handler) http.Handler { | |
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
logger.Println("before") | |
defer logger.Println("after") | |
h.ServeHTTP(w, r) | |
}) | |
} | |
} |
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 | |
/** | |
* numberFormatPrecision | |
* | |
* Will format the given number by $precision and separated by $separator. | |
* | |
* @param string|int|float $number | |
* @param int $precision | |
* @param string $separator |
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
- create a .py file with 2 classes (OAuth2ProtectedResourceMixin and OAuth2ProtectedGraph). see 'utils.py' file | |
- then in your Django's 'urls.py', wrap the graphql endpoint. see 'urls.py. |
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
from typing import List | |
def flatten_list(items: List) -> List[int]: | |
""" | |
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers. | |
e.g. [[1,2,[3]],4] -> [1,2,3,4]. | |
>>> nested: list = [[1, 2, [3, [4, 4, 8, [8, 8, 7]]]], 4, [], None] | |
>>> expected: List[int] = [1, 2, 3, 4, 4, 8, 8, 8, 7, 4] |
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
add_filter('appthemes_plupload_config', 'enable_plupload_multisel', 10 ,1); | |
function enable_plupload_multisel($app_plupload_config) | |
{ | |
$app_plupload_config['plupload']['multi_selection'] = true; | |
return $app_plupload_config; | |
} |
OlderNewer