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 | |
// defining resource-levels as arrays | |
return array( | |
'exam' => array( | |
'levels' => array( | |
'view', | |
'create', | |
'edit', | |
'delete' |
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
#!/usr/bin/env python | |
## Mysql-Python basic examples. | |
## All code is taken from [here](http://zetcode.com/databases/mysqlpythontutorial/) | |
## Gist created only for quick reference purpose | |
import sys | |
import _mysql | |
import MySQLdb as mdb |
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
#!/bin/bash | |
## This shell script will read all names from repos.txt | |
## which are names of git repositories located at | |
## git@main-reposerver:/path/to/repos | |
## if a mirror is not created, it will create | |
## | |
## other wise it will try to update the mirror | |
## | |
## Main purpose of having mirrors is backup so pushing |
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 | |
class DummyCacheBackend implements CacheBackend { | |
public function get($key) { | |
return array(); | |
} | |
public function set($key, $value) { | |
return; |
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
The no. of lines in erlang implementation is half that in python! | |
Observe how pattern matching alone gets rid of the selector functions |
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
#!/usr/bin/env python | |
## An alternative approach for sorting list of dicts by multiple | |
## levels of criteria | |
## Original example: http://sleepythread.blogspot.in/2012/08/sorting-hash-on-more-than-one-key-with.html | |
import pprint | |
pp = pprint.PrettyPrinter(indent=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
[ | |
{ | |
"symbol": "Lek", | |
"code": "ALL", | |
"uhex": [ | |
"4c", | |
"65", | |
"6b" | |
], | |
"name": "Albania Lek" |
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
.myKodecrmButton { | |
display: block; | |
background: #08C; | |
color: #fff; | |
padding: 5px; | |
} |
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 ChatLocaleMiddleware(object): | |
def process_request(self, request): | |
if request.path in ['/jsi18n/']: | |
return None | |
match = SHOPPER_CHAT_PATH.match(request.path) | |
if match is not None: | |
appid = match.groups()[0] | |
try: | |
store = Store.objects.get(appid=appid) |
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
# View for generating a dynamic index page for the Flask app. | |
# Note: Function name used as title and docstring used as description | |
# so choose them accordingly | |
@app.route('/') | |
def index(): | |
"""Index | |
""" | |
def title(r): | |
return r.endpoint.replace('_', ' ').title() |
OlderNewer