Skip to content

Instantly share code, notes, and snippets.

View sarukuku's full-sized avatar

Joonas Salovaara sarukuku

View GitHub Profile
@jehna
jehna / react-css-error-highlight.css
Last active October 18, 2018 14:28
React CSS error highlighter
[class*="undefined"],
[class*="null"] {
border: red 5px solid !important;
background: #0f0 !important;
color: #00f !important;
}
[class*="undefined"]::after,
[class*="null"]::after {
content: "YOU HAVE AN ERROR IN YOUR CODE" !important;
@onnimonni
onnimonni / disable-updates-and-external-connections.php
Last active August 26, 2016 07:21
Instead of using this small hack consider using this plugin https://github.com/devgeniem/wp-core-blocker. It takes care of much more edge cases and core functionality.
<?php
/**
* Plugin Name: Disable All Updates and External Connections
* Description: Plugin which disables core, plugin and theme updates and connections to wordpress.org This is quite useful in local development
* Version: 1.0.0
* Author: Onni Hakala
* Author URI: https://github.com/onnimonni
* License: MIT License
*/
@ajuliano
ajuliano / polylang och ACF Options Page
Last active September 19, 2018 14:42
polylang och ACF Options Page
/*
* Få Polylang och ACF Options Page att fungera
*
* http://www.advancedcustomfields.com/resources/multilingual-custom-fields/ (Längst ned på sidan)
*/
add_filter('acf/settings/default_language', function( $language ) {
if ( function_exists( 'pll_current_language' ) ) {
@onnimonni
onnimonni / remove-accents-on-upload.php
Last active February 26, 2018 11:02
Wordpress plugin which sanitizes files on upload. This fixes OS-X NFD characters as well if you have Normalizer class and icu library installed.
<?php
/**
* Plugin Name: Remove accents from files on upload
* Plugin URI: https://gist.github.com/onnimonni/d58bdcff44f8208a15c7
* Description: Sanitize accents from Cyrillic, German, French, Polish, Spanish, Hungarian, Czech, Greek, Swedish during upload. Also fix OS-X NFD filenames.
* Version: 1.0
* Author: Onni Hakala
* Author URI: http://github.com/onnimonni
* License: GPLv3
*/
(function(){
'use strict';
// Twitter overwrites console.log; this restores it
console.log = Object.getPrototypeOf(console).log;
let $container = $('.stream-items');
let $items = $container.children('.stream-item');
console.log(`Number of items at the beginning: ${$items.length}`);
@kirkonrails
kirkonrails / log all jQuery events
Created April 9, 2014 13:20
Log all jQuery events to console via redfine jquery trigger
var oldJQueryEventTrigger = jQuery.event.trigger;
jQuery.event.trigger = function( event, data, elem, onlyHandlers ) {
console.log( event, data, elem, onlyHandlers );
oldJQueryEventTrigger( event, data, elem, onlyHandlers );
}
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 2, 2024 12:46
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@maxrice
maxrice / gist:7918315
Created December 11, 2013 20:55
Get SKU from products in an order
<?php
$order = new WC_Order( $order_id );
foreach ( $order->get_items() as $item_key => $item ) {
$product = $order->get_product_from_item( $item );
$sku = $product->get_sku();
@robmiller
robmiller / .gitconfig
Created July 17, 2013 07:52
Some useful Git aliases that I use every day
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
@gre
gre / easing.js
Last active April 30, 2024 04:58
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {