Skip to content

Instantly share code, notes, and snippets.

View keoshi's full-sized avatar
🙌
What's up?

Filipe Varela keoshi

🙌
What's up?
View GitHub Profile
@psorensen
psorensen / tinymce-add-formats.md
Last active August 23, 2019 06:24
Wordpress/TinyMCE - Add elements to formats dropdown

Adding Elements to the TinyMCE Format Dropdown

On a recent migration project, one of the requirements was to add a few blockquote styles to the TinyMCE dropdown list to match the editorial process of the old CMS. Wordpress provides a filter to add a secondary or tetriary dropdown, but if you only have a couple additional elements, it seems like bad UX to seperate it from the original dropdown.

Going off a tip from Chancey Mathews, I realized that Wordpress does not send a argument for block_formats when initializing TinyMCE, thus relying on the defaults. By adding this argument to the tiny_mce_before_init filter, we can add in our extra elements*:

* Note: since we're overriding the defaults, we need to include the original elements (p, h1-h6..etc)

function mce_formats( $init ) {
@bdno86
bdno86 / camphor.scss
Last active August 30, 2023 07:55
camphor
$camphor300:'d09GMgABAAAAAQ5UABIAAAAEn0QAAQ3tAAEZmQAAAAAAAAAAAAAAAAAAAAAAAAAAG4SkahzOKgZgFotgAIosCCIJgnMRCAqLlgCKvTwBNgIkA5lwE4GnDguZdAAEIAW7bwcgDHJb0WS0WUXZkokWaBHx4wKbY7TigANIU/t980QCGzI/IkCsdbqJZwY1ZOgWDngIamw3I43435Dd+zJ1kNmKVp/DvXNAwaNm//////////////////+/NZkMZ5cAl0CpbZ3oiwloFA5GyIWNzOYVLt1bpXPX+pABI2fo5rMZpgVYIzYqgxt92ajECqUKh2G9gaOCVRC23VSRVypHfbvb7wYcwEM25WArF0esm1yKzDixrJRdcBGtcpBZTFbFbIl8LIU4gWOnEdSITqkoGrHWJ8ywn9eVFWWk3lC6m07qp1TXntHaWp6ekYHLrFoyzOXYiQnn2kWX2zqMaFBTca25vHKndPhJV66HRhQzL9lB3OT20KGTXuFHu62wm1qzoV/iTnaiLdc8o/D7B+1O94BrjSE3cia6U1A5XNp0kHmUj8IMBaeiGaiNJV7b1csb0bq8EWYo2h1TuipR+7hmYjxeZsonGLNcmgsKp5EUDCEj9SvRyxX2uMUNfINmfNqglBYNNtjtNmdwWV2ly4uQKheyDyka2RTRoQ3IEfs+0BNcGJ4Z5AnmHNpFbCKW5PsXkAzJ6VVzzVMo0fwIUpQQT67itTNRE946/NxDashl9KuAFUbZ6yW91vObh+WAMZ1mQ1J4wotF6KXHuo65X6wSz406hW/T6XZMf/6W+HGYUxCDfhyjPaoMGcWccmbYM/H35NdHTOd79Jg0ho/BDBvRy2vcg8pHsv07UYiKrDFeqzL0Qk7qCkXLuukl2EKuR3xS6VtsLEaT0BfWoDYoQ1YvEjjT729XNMYoCX3j+2ApedBG/UHLOJ7AAnfPSqdmmePsY+522MpfPaf7kf6fIJMn0/4SE6PmuI3yjyeGjWn+1qj/ukf09DE
@devinsays
devinsays / jetpack.php
Last active July 26, 2022 12:36
Query by JetPack Related Posts
<?php
/**
* Prevents Related Posts from displaying in content area
*/
function prefix_remove_rp() {
if ( class_exists( 'Jetpack_RelatedPosts' ) ) {
$jprp = Jetpack_RelatedPosts::init();
$callback = array( $jprp, 'filter_add_target_to_dom' );
remove_filter( 'the_content', $callback, 40 );
}
@rafaelrinaldi
rafaelrinaldi / README.md
Last active January 22, 2021 09:04
`.mov` to `.gif` using QuickTime and Photoshop

.mov to .gif using QuickTime and Photoshop

This is my prefered way to create GIF animations for demos and whatnot.

Steps

  1. QuickTime » File » New Screen Recording
  2. Select area to record » Start recording your thing
  3. File » Export » Select max resolution available » Save
  4. Photoshop » Import » Video Frames to Layers (no need to follow step 2 if not on retina screen)
@fkling
fkling / App.js
Last active February 1, 2018 03:43
Bootstrap files for React + JSX with browserify and gulp.js
"use strict";
// Use
// var React = require('./react');
// instead if you are loading React externally, via a <script> element
var React = require('react');
var App = React.createClass({
render: function() {
return <h3>Hello World!</h3>;
@t-io
t-io / osx_install.sh
Last active October 22, 2023 13:04
Install most of my Apps with homebrew & cask
#!/bin/sh
echo Install all AppStore Apps at first!
# no solution to automate AppStore installs
read -p "Press any key to continue... " -n1 -s
echo '\n'
echo Install and Set San Francisco as System Font
ruby -e "$(curl -fsSL https://raw.github.com/wellsriley/YosemiteSanFranciscoFont/master/install)"
echo Install Homebrew, Postgres, wget and cask
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
@bloodyowl
bloodyowl / gist:6543749
Created September 12, 2013 21:02
Jony Ive bullshit generator
;(function(){
var text = [
[
"Right from the beginning, it appeared to us that designing the new"
, "When we first thought about it, we understood that designing the new"
]
, [
" iPhone"
, " iMac"
@westonruter
westonruter / gist:5475349
Last active August 12, 2021 07:00 — forked from markjaquith/gist:2653957
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
cache_fragment_output( 'unique-key', 3600, function () {
functions_that_do_stuff_live();
these_should_echo();
});
*/
function cache_fragment_output( $key, $ttl, $function ) {
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.