Skip to content

Instantly share code, notes, and snippets.

View cdracars's full-sized avatar
🎯
Focusing

Cody Dracars cdracars

🎯
Focusing
  • CFS Brands, LLC
  • Oklahoma City Oklahoma
  • X @cdracars
View GitHub Profile
@ricardozea
ricardozea / _font-face.scss
Last active December 13, 2015 03:20
Sass partial: @font-face mixin
// Since .woff has almost perfect support all the way back to IE9 except for Opera Mini,
// I removed the calls to .eot, .ttf and .svg. to streamline the mixin -- http://caniuse.com/#search=woff
// Note: IE8, IE7, IE6, old Safari in Android and iOS will gracefuly degrade to system fonts.
@mixin fontFace($font-family, $file-path) {
@font-face {
font: {
family: $font-family;
weight: normal;
style: normal;
}
@pixelwhip
pixelwhip / block.tpl.php
Created July 14, 2012 16:20
Modular Stylesheets - Design 4 Drupal
<?php
/**
* @file
* Default theme implementation to display a block.
*
* Available variables:
* - $block->subject: Block title.
* - $content: Block content.
* - $block->module: Module that generated the block.
@basdenooijer
basdenooijer / demo.php
Created May 4, 2011 06:26
Solarium example with facet filtering and pagination
<?php
require('../library/Solarium/Autoloader.php');
Solarium_Autoloader::register();
$client = new Solarium_Client();
$client->setHost('192.168.1.2');
$client->setCore('geonames');
$query = new Solarium_Query_Select;
@joshmiller83
joshmiller83 / commerce_2_order.php
Created September 28, 2016 15:12
Create an order programmatically for Drupal Commerce 2.x
<?php
$order_type = "default";
$store_id = 1;
$uid = 0;
$entity_type_manager = \Drupal::service('entity_type.manager');
$order_storage = $entity_type_manager->getStorage('commerce_order');
$new_order = $orderStorage->create([
'type' => $order_type,
'store_id' => $store_id,
@saralgyaan
saralgyaan / auto_delete
Created January 12, 2019 09:44
This script auto deletes messages from your gmail inbox.
#!/usr/bin/python3.6
"""AutoDelete
This script auto deletes messages from your gmail inbox.
The perfect usecase is deleting the OTP messages received from banks after certain time period.
or deleting the messages received from certain services which doesn't have unsubscribe option.
Many parts of this script are copied from EZGmail by Al Sweigart (https://github.com/asweigart/ezgmail)
"""
@signalpoint
signalpoint / example.php
Last active July 16, 2022 23:41
Drupal 8 Set Message Example
<?php
// The drupal_set_message() function is being deprecated!
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
// In some custom code.
\Drupal::messenger()->addMessage('Say something else');
@CrookedNumber
CrookedNumber / gist:8856939
Last active September 12, 2022 17:33
How to create Trello Cards from the Command Line (with a ~10 minute set-up)
  1. This is quick and dirty and not terribly maintainable. But it's very useful for creating quick cards from the terminal. Requires familiarity with Trello and a basic understanding of bash.
  2. Log-in to Trello.
  3. Go to: https://trello.com/1/appKey/generate
  4. Make note of your key. Replace any mention of YourTrelloKey with this hash.
  5. Create a token. Go to https://trello.com/1/authorize?key=YourTrelloKey&name=SimpleBASHScript&expiration=never&response_type=token&scope=read,write in your browser and follow directions.
  6. Make note of the token. Replace any mention of YourTrelloToken with this looong hash.
  7. Pick a reasonable number of the most popular boards you use. Grab the URLs of those boards. At the same time, think of short, one-word, easy-to-remember names for each board (e.g., work, homeprojects, wedding).
  8. Grab the board IDs of the boards you chose. It'll be the ~8 character hash-like string in the URL. E.g., for https://trello.com/b/aWsGTrsD/work the ID is aWsGTrsD
  9. One by one, plug thos
@rrosiek
rrosiek / install_mysql.sh
Last active June 5, 2023 07:08
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Tested with Ubuntu 16.04.
#! /usr/bin/env bash
###
#
# install_mysql.sh
#
# This script assumes your Vagrantfile has been configured to map the root of
# your application to /vagrant and that your web root is the "public" folder
# (Laravel standard). Standard and error output is sent to
# /vagrant/vm_build.log during provisioning.
@DiegoQueiroz
DiegoQueiroz / query_activedirectory.py
Last active October 18, 2023 10:43
Python-LDAP Query Active Directory Example (with paged results to prevent ldap.SIZELIMIT_EXCEEDED exception)
# -*- coding: utf-8 -*-
# requires python-ldap (usually pip install python-ldap)
# But this package requires OpenLDAP libraries, so it is a pain to install it on Windows.
# So, if you're on Windows, I recomment to use pre-compiled binaries with this command (virtualenv supported):
# pip install https://download.lfd.uci.edu/pythonlibs/h2ufg7oq/python_ldap-3.1.0-cp37-cp37m-win_amd64.whl
import ldap
from ldap.controls import SimplePagedResultsControl
@gregjhogan
gregjhogan / curl-push-azure-storage-blob.sh
Created April 20, 2017 18:13
Push a file to a blob in an Azure storage account
curl -X PUT -T ./{file.dat} -H "x-ms-date: $(date -u)" -H "x-ms-blob-type: BlockBlob" "https://{storageaccount}.blob.core.windows.net/backups/{file.dat}?{sas-token}"