Skip to content

Instantly share code, notes, and snippets.

@sarahcssiqueira
sarahcssiqueira / webpack dependencies
Last active April 19, 2024 18:15
webpack.config.js for WordPress projects
{
"devDependencies": {
"@babel/cli": "^7.22.9",
"@babel/core": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"babel-loader": "^9.1.2",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^7.0.3",
@pjobson
pjobson / preyosemite_usb_stick_creation.md
Last active May 2, 2024 10:35
How to Create a Bootable OS X USB Stick Pre-Yosemite

Pre-Yosemite USB Stick Creation

Yosemite and later used a built in program called createinstallmedia to automagically make a USB stick. It is possible to create a bootable USB stick without this program.

You'll need an 8GB USB stick and either the Install Mac OS X Lion.app or InstallESD.dmg or BaseInstall.dmg.

Open Terminal, you'll need it in most of this tutorial.

We're going to need to start by getting to the actual installation disk image.

@a-barbieri
a-barbieri / loop-per-pyetro.php
Last active November 11, 2019 14:28
Per Pyetro
<?php if (have_posts()): ?>
<ul id="image-data-list">
<?php while(have_posts()): the_post(); ?>
<li data-image-url="<?= your_post_image_url ?>"></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>

Shortcuts on Mac Terminal

  • Tab Auto-complete file and folder names
  • Ctrl + A Go to the beginning of the line you're currently typing on
  • Ctrl + E Go to the end of the line you're currently typing on
  • Ctrl + U Clear the line before the cursor
  • Ctrl + K Clear the line after the cursor
  • Ctrl + W Delete the word before the cursor
  • Ctrl + T Swap the last two characters before the cursor
  • Esc + T Swap the last two words before the cursor
@subfighter3
subfighter3 / osx-setup.sh
Created February 4, 2019 15:42 — forked from somebox/osx-setup.sh
Set up an OSX machine from zero to awesome. Uses Homebrew (and cask, fonts, etc). Focused on Ruby/Rails development, includes rvm, xquartz, editor fonts, sublime text, and many tools.
#!/bin/bash
# A script to set up a new mac. Uses bash, homebrew, etc.
# Focused for ruby/rails development. Includes many utilities and apps:
# - homebrew, rvm, node
# - quicklook plugins, terminal fonts
# - browsers: chrome, firefox
# - dev: iterm2, sublime text, postgres, chrome devtools, etc.
# - team: slack, dropbox, google drive, skype, etc
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 3, 2024 12:55
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@iksi
iksi / hex-to-hsl.php
Created April 18, 2018 10:44
convert hex to hsl
<?php
// http://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/
// convert hex to hsl
$hex = str_split(ltrim('#0099cc', '#'), 2);
// convert the rgb values to the range 0-1
$rgb = array_map(function($part) {
return hexdec($part) / 255;
@carasmo
carasmo / for-include-or-functions.php
Created January 29, 2018 18:08
Add Custom Post Type and Taxonomy Terms to wp_link_query. Link search function in WordPress editor add Custom Post Types and Taxonomy Terms
<?php
//don't re add the php tag above
add_filter('wp_link_query', 'cab_add_custom_post_type_archive_link', 10, 2);
/**
* Add Custom Post Type archive to WordPress search link query
* Author: https://github.com/mthchz/editor-archive-post-link/blob/master/editor-archive-post-link.php
*/
function cab_add_custom_post_type_archive_link( $results, $query ) {
@asadowski10
asadowski10 / fix-conflict-js-composer-yoast.php
Created March 16, 2017 16:44
Fix Conflict between Yoast SEO and VC Grid Builder
<?php
/**
* @source : https://github.com/Yoast/wordpress-seo/issues/6219
**/
add_action( 'vc_backend_editor_render', 'bea_fix_conflict', 9999 );
function bea_fix_conflict() {
wp_dequeue_script( 'vc_vendor_yoast_js' );
if ( wp_script_is( 'yoast-seo-post-scraper' ) ) {
@amboutwe
amboutwe / yoast_seo_opengraph_change_image_size.php
Last active January 11, 2024 20:48
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail'
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/
*/