Skip to content

Instantly share code, notes, and snippets.

View martinwolf's full-sized avatar
🐺

Martin Wolf martinwolf

🐺
View GitHub Profile
@aahan
aahan / WordPress Custom Global Variables.md
Last active March 28, 2024 19:26
Creating and using custom global variables in wordpress.

First create global variables (in functions.php or as a mu-plugin):

<?php

/*
 * CUSTOM GLOBAL VARIABLES
 */
function wtnerd_global_vars() {
@xinan
xinan / material-theme.itermcolors
Created August 1, 2015 16:18
Material Theme iTerm2 Port
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.25882352941176467</real>
<key>Green Component</key>
<real>0.21176470588235294</real>
@bradfrost
bradfrost / gist:59096a855281c433adc1
Last active September 4, 2023 15:01
Why I'm Not A JavaScript Developer

Answering the Front-end developer JavaScript interview questions to the best of my ability.

  • Explain event delegation

Sometimes you need to delegate events to things.

  • Explain how this works in JavaScript

This references the object or "thing" defined elsewhere. It's like "hey, thing I defined elsewhere, I'm talkin' to you."

  • Explain how prototypal inheritance works.
@ian-p-cooke
ian-p-cooke / add_wsl_exclusions.ps1
Last active November 12, 2022 05:02
powershell script to add WSL exclusions
$win_user = "ipc"
$linux_user = "ipc"
$package = "CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc"
$base_path = "C:\Users\" + $win_user + "\AppData\Local\Packages\" + $package + "\LocalState\rootfs"
$dirs = @("\bin", "\sbin", "\usr\bin", "\usr\sbin", "\home\" + $linux_user + "\.cargo\bin")
$dirs | ForEach { Add-MpPreference -ExclusionProcess ($base_path + $_ + "\*") }
Add-MpPreference -ExclusionPath $base_path
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
@valeryan
valeryan / WindowsSetup.md
Last active May 4, 2021 09:25
Local WSL Setup

Deprecated in favor of Valet Wiki Page

I set up the wiki page for the valet-wsl project and moved the install guide there. This way it can have user contributions. Please have all disscussions or issues under the valet-wsl project so I can be aware of it. Please go to Valet Wsl Installation Guide

@murtaugh
murtaugh / 1. single-line.html
Last active April 21, 2021 16:23
Blockquote patterns for ALA
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>
## Introduction
This is a guide on how to get setup with Windows Subsystem for Linux (Ubuntu) for Laravel Development (LEMP). Which gives you the flexibility of the Linux terminal and the application compatibility of Windows.
Recently I decided to switch from Ubuntu 16.04 to Windows 10 Pro as I wanted access to applications that are not available on Linux based operating systems (i.e. Microsoft Office 2016, Adobe Suite). I know there are plenty of alternatives (or things like Play on Linux, Lutris, Crossover), but I wanted to tests on what my customers are using and I got tired of using virtual machines.
All that to say that I’ve got Ubuntu application (Windows Subsystem for Linux) working on Windows 10 Pro, so I didn’t lose any of the power of the Linux terminal but gained all the application compatibility of the Windows 10 operating system.
### Caveats
I’m using the Insider Program builds so my current system looks like:
@sergejmueller
sergejmueller / _scripts.js
Last active May 19, 2018 13:05
Lazyload-Technik fürs Nachladen der Bilder. Besonderheit: Bilder werden 3 Screens (3 x Browserfentserhöhe) vor der eigentlichen Position geladen, um beim Erreichen des Viewports bereits sichtbar zu sein. Ohne noscript-Fallback.
addEventListener(
'scroll',
function() {
var i,
img,
rect,
images = document.querySelectorAll('[lazyload-src]');
if ( ! images.length ) {
return;
@andrewrocco
andrewrocco / ga-ratio.js
Created July 17, 2012 15:48
Pixel Aspect Ratio Google Analytics Custom Variable
// Create the test
var pixelRatio = (window.devicePixelRatio >= 1.5) ? "high" : "normal";
..
// Pass it along through GA
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
// --- IMPORTANT LINE!
// params: event method, custom variable slot, variable name, variable value, scope level