Skip to content

Instantly share code, notes, and snippets.

View pije76's full-sized avatar

panjianom pije76

View GitHub Profile
@pije76
pije76 / forms.py
Created March 27, 2020 01:52 — forked from maraujop/forms.py
django-crispy-forms bootstrap form example
# -*- coding: utf-8 -*-
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Div, Submit, HTML, Button, Row, Field
from crispy_forms.bootstrap import AppendedText, PrependedText, FormActions
class MessageForm(forms.Form):
text_input = forms.CharField()
@pije76
pije76 / part.md
Created February 18, 2020 11:52 — forked from oisobstudio/part.md
Django Pagination Server-Side Menggunakan DataTable

myapp/views.py

import json

from django.views.generic import View
from django.http import HttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.db.models import Q
from django.core.serializers.json import DjangoJSONEncoder
@pije76
pije76 / functions.php
Created February 2, 2020 09:56 — forked from tripflex/functions.php
WP Job Manager Job List Custom Sort by Meta Field Value
<?php
// https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
function xyz_custom_orderby( $query_args ) {
// Use meta_value_num for numeric sorting (if issues with meta_value)
$query_args[ 'orderby' ] = 'meta_value';
$query_args[ 'order' ] = 'ASC';
return $query_args;
}
add_filter( 'job_manager_get_listings_args', 'xyz_custom_orderby', 99 );
@pije76
pije76 / passenger_wsgi.py
Created December 30, 2019 22:35 — forked from jhamrick/passenger_wsgi.py
Passenger configuration for psiTurk on DreamHost
import sys
import os
import logging
from logging.handlers import RotatingFileHandler
# This script assumes you have created a subdomain on DreamHost
# that is configured for Passenger. It also assumes you have created
# a Python virtual environment in the root of that subdomain and
# installed psiTurk inside it.
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04
@pije76
pije76 / LICENCE SUBLIME TEXT
Created December 24, 2019 05:33 — forked from ityouknow/LICENCE SUBLIME TEXT
Sublime Text 3 Serial key build is 3176
## Sublime Text 3 Serial key build is 3176
> * Added these lines into /etc/hosts
127.0.0.1 www.sublimetext.com
127.0.0.1 license.sublimehq.com
> * Used the license key
----- BEGIN LICENSE -----
@pije76
pije76 / Sublime Text 3 License Key
Created December 24, 2019 05:33 — forked from nonohry/Sublime Text 3 License Key
Sublime Text 3 License Key
—– BEGIN LICENSE —–
Andrew Weber
Single User License
EA7E-855605
813A03DD 5E4AD9E6 6C0EEB94 BC99798F
942194A6 02396E98 E62C9979 4BB979FE
91424C9D A45400BF F6747D88 2FB88078
90F5CC94 1CDC92DC 8457107A F151657B
1D22E383 A997F016 42397640 33F41CFC
E1D0AE85 A0BBD039 0E9C8D55 E1B89D5D
@pije76
pije76 / points-for-publishing-content-hook-example
Created July 28, 2019 10:12 — forked from gabrielmerovingi/points-for-publishing-content-hook-example
Custom hook that allows you to set a specific amount of points to reward users when they publish posts in a pre-defined sets of categories.
/**
* Register Custom Hook
* @since 1.0
* @version 1.0
*/
add_filter( 'mycred_setup_hooks', 'mycred_pro_register_publish_content_category_hook' );
function mycred_pro_register_publish_content_category_hook( $installed ) {
$installed['publish_category_content'] = array(
'title' => __( '%plural% for Publishing Content (Categories)', 'mycred' ),
@pije76
pije76 / functions.php
Created July 26, 2019 22:40 — forked from Luminus/functions.php
Display the "Sold By: Vendor Name" of Product Vendors under the product name on single product page & Hide the original one
<?php
if ( class_exists( 'WC_Product_Vendors_Vendor_Frontend' ) ) {
add_action( 'woocommerce_single_product_summary', array( WC_Product_Vendors_Vendor_Frontend, 'add_sold_by_single' ), 5 );
}
<?php
/**
* Template Name: Lessons
*
* @package ecokids_theme
*/
get_header(); ?>