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 logging | |
# create logger | |
logger = logging.getLogger("logging_tryout2") | |
logger.setLevel(logging.DEBUG) | |
# create console handler and set level to debug | |
ch = logging.StreamHandler() | |
ch.setLevel(logging.DEBUG) |
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
def profile(request): | |
response_model = generate_response(request) | |
# Generate CSV | |
from django.http import HttpResponse | |
import csv | |
users = User.objects.all() | |
response = HttpResponse(content_type='text/csv') |
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
from django.shortcuts import HttpResponseRedirect | |
#from employee.models import UserProfile | |
class LoginRequiredMiddleware(object): | |
def __init__(self, get_response): | |
self.get_response = get_response | |
def __call__(self, request): | |
response = self.get_response(request) |
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
:: Run the following command in your project to save your currently installed plugins into config.xml: | |
cordova plugin save | |
:: To upgrade | |
npm install -g cordova | |
cd my_project | |
cordova platform rm ios | |
cordova platform add [email protected] |
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
@echo off | |
set /p UserInputPath= Enter directory name : | |
:: mkdir %UserInputPath% | |
:: mkvirtualenv biman | |
:: workon biman | |
:: pip install django | |
:: pip install django-admin | |
django-admin startproject %UserInputPath% |
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 | |
global $wpdb; | |
if ( check_admin_referer( plugin_basename( __FILE__ ) ) ) { | |
$revisions = $wpdb->get_results( | |
"SELECT 'ID' AS revision_id | |
FROM ($wpdb->posts) | |
WHERE 'post_type' = 'revision' | |
ORDER BY 'ID' DESC" | |
); |
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 | |
add_action( 'attachment_fields_to_edit', array($this, 'tmx_attachment_fields_to_edit'), 10, 2 ); | |
public function tmx_attachment_fields_to_edit( $form_fields, $post ){ | |
// Apply only in image attachment pages | |
if( $post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/jpg' || $post->post_mime_type == 'image/png' ){ | |
$form_fields['tmx-apply-filter-sbutton'] = array( | |
'label' => __('Add Image effects', 'themeaxe'), | |
'input' => 'html', |
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
<div id="tmx-image" data-img="<?php echo wp_get_attachment_url( $_GET['attachment_id'] ); ?>"> | |
</div> | |
<script> | |
var tmx_img = $('#tmx-image').data('img'); | |
$('#tmx-save').on('click',function(){ | |
Caman("#tmx-image",tmx-image, function () { | |
// this = formatted image using Caman JS for example | |
var new_image = this.toBase64(); |