Skip to content

Instantly share code, notes, and snippets.

@cfxd
cfxd / chosenjs-less-for-bootstrap-and-woocommerce-checkout.less
Last active August 29, 2015 14:03
This will style WooCommerce's ChosenJS select boxes on the WooCommerce checkout page to match your existing Bootstrap form styles (assuming you've made any style changes in LESS) and even replaces the default background images with Bootstrap's built in Glyphicons.
// first some helpful mixins
.abs {
position: absolute;
}
.rel {
position: relative;
}
.position(@top; @right; @bottom; @left) {
top: @top;
right: @right;
@kgriffs
kgriffs / gist:b4eb14c91212f2fa3a0a
Created November 18, 2014 18:49
SQLAlchemySessionManager (B)
# =========================================================================
# middleware.py
# =========================================================================
import sqlalchemy.orm.scoping as scoping
class SQLAlchemySessionManager(object):
def __init__(self, session_factory, auto_commit=False):
self._session_factory = session_factory
self._scoped = isinstance(session_factory, scoping.ScopedSession)
@fndtn357
fndtn357 / module.php
Last active February 28, 2017 16:14 — forked from kevinquillen/module.php
/**
* Creates a temporary table to hold values from an uploaded CSV.
* @param $table_name
* @param $columns
* @param $message
* @param $context
*/
function csv_import_create_temp_table($table_name, $columns) {
if (db_table_exists($table_name)) {
return;
@magnetikonline
magnetikonline / README.md
Last active April 30, 2025 11:11
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script which will:

  • Iterate all commits made within a Git repository.
@bdlangton
bdlangton / Blocks.md
Last active February 3, 2026 12:41
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');