Skip to content

Instantly share code, notes, and snippets.

View flegfleg's full-sized avatar

Florian Egermann flegfleg

View GitHub Profile
@lordspace
lordspace / qs_blog675_grant_customizer_access.php
Last active February 14, 2021 16:46
How to Allow Non-Admin Users to Access WordPress Customizer. Check the latest version on the qSandbox - https://qsandbox.com/675
<?php
/**
* How to Allow Non-Admin Users to Access WordPress Customizer. Published on the qSandbox - https://qsandbox.com/675
* <a href="https://qsandbox.com/?utm_source=qs_blog_code&utm_medium=p675" title="Free Test/Staging WordPress site by qSandbox.com">Free Test/Staging WordPress site by qSandbox.com</a>
* @param array $all_caps
* @param array $cap
* @param array $args
* @return array array
* @see https://codex.wordpress.org/Plugin_API/Filter_Reference/user_has_cap
@wassname
wassname / to_filename.py
Last active August 26, 2024 20:59
python convert string to safe filename
"""
Url: https://gist.github.com/wassname/1393c4a57cfcbf03641dbc31886123b8
"""
import unicodedata
import string
valid_filename_chars = "-_.() %s%s" % (string.ascii_letters, string.digits)
char_limit = 255
def clean_filename(filename, whitelist=valid_filename_chars, replace=' '):
@tristanisfeld
tristanisfeld / browsersync.js
Last active November 10, 2023 23:58
Gulp 4 - Multifile tasks w/ external config. Basic gulpfile template for use with multiple task files, using gulp-load-plugins
// =========================================================
// Gulp Task: browsersync
// NOTE: Using gulp v4
// Description: Sync sass, typescript, html, and browser
// using external config or add modify src
// npm install --save-dev browser-sync gulp-typescript gulpjs/gulp.git#4.0 gulp-load-plugins
// Options: node-sass gulp-sass || gulp-ruby-sass
// =========================================================
var config = require('../config.js');
var browserSync = require('browser-sync').create();
@gthln
gthln / gist:8401080
Created January 13, 2014 14:23
Install Composer on Managed Hosting at Domainfactory

Install Composer on Managed Hosting at Domainfactory

Step 1:

Log in to your Managed Hosting Server via SSH

Step 2:

Add these two lines to .bashrc:

@cimmanon
cimmanon / flexbox.scss
Last active September 17, 2020 15:05 — forked from anonymous/Flexbox mixins
This collection of Sass mixins to cover all 3 flexbox specifications that have been implemented. More information can be found here: https://gist.github.com/cimmanon/727c9d558b374d27c5b6
@import "compass/css3/shared";
// NOTE:
// All mixins for the 2009 spec have been written assuming they'll be fed property values that
// correspond to the standard spec. Some mixins can be fed values from the 2009 spec, but don't
// rely on it. The `legacy-order` mixin will increment the value fed to it because the 2009
// `box-ordinal-group` property begins indexing at 1, while the modern `order` property begins
// indexing at 0.
// if `true`, the 2009 properties will be emitted as part of the normal mixin call
@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
@florianfiegel
florianfiegel / gist:1243753
Created September 26, 2011 23:26
Script for GrandTotal (http://www.grandtotal.biz/GrandTotal/) that hides the quantity of an item if the unit is "Pauschal" and quantity is 1.
if (grandtotalrecord.quantity() == 1 && grandtotalrecord.unit() == "Pauschal")
"";
else
grandtotalrecord.quantity();
@bueltge
bueltge / post-process.php
Created June 24, 2011 21:08
WordPress Custom Post Type: Insert post via Frontend
<?php
/**
* post-process.php
* make sure to include post-process.php in your functions.php. Use this in functions.php:
*
* get_template_part('post-process');
*
*/
function do_insert() {
if( 'POST' == $_SERVER['REQUEST_METHOD']
@kemitchell
kemitchell / today.AppleScript
Created January 16, 2011 05:16
Short AppleScript for dumping descriptions of today's events from iCal to the console. Meant for use with GeekTool.
#!/usr/bin/osascript
-- calendar from which to ignore events
set TASKS_CALENDAR to "Toodledo iCal"
-- the current timestamp
set now to (current date)
-- midnight this morning
set today to now - (time of now)
-- midnight tomorrow morning
set tomorrow to (today) + (24 * 60 * 60)
-- list of output lines