Skip to content

Instantly share code, notes, and snippets.

View dashaluna's full-sized avatar

Dasha Luna dashaluna

View GitHub Profile
@mattheu
mattheu / HM Debugging Functions
Created July 13, 2013 11:46
2 simple functions we use at Human Made for debugging.
/**
* Intelligently replacement for print_r & var_dump.
*
* @param mixed $code
* @param bool $output. (default: true)
* @return $code
*/
function hm( $code, $output = true ) {
@Pushplaybang
Pushplaybang / show_admin_hooks.php
Last active December 28, 2015 23:59
list WordPress admin page hooks in the contextual help, super useful - thanks tutsplus.
add_action( 'contextual_help', 'wptuts_screen_help', 10, 3 );
function wptuts_screen_help( $contextual_help, $screen_id, $screen ) {
// The add_help_tab function for screen was introduced in WordPress 3.3.
if ( ! method_exists( $screen, 'add_help_tab' ) )
return $contextual_help;
global $hook_suffix;
// List screen properties
@Rarst
Rarst / .maintenance
Created April 21, 2012 12:36
WordPress maintenance mode
<?php
function is_user_logged_in() {
$loggedin = false;
foreach ( (array) $_COOKIE as $cookie => $value ) {
if ( stristr($cookie, 'wordpress_logged_in_') )
$loggedin = true;
}
return $loggedin;
}
if ( ! stristr($_SERVER['REQUEST_URI'], '/wp-admin') && ! stristr($_SERVER['REQUEST_URI'], '/wp-login.php') && ! is_user_logged_in() )
@andreilupu
andreilupu / How to send a POST request from WordPress admin Dashboard – JS
Last active April 6, 2018 09:47
How to send a POST request from WordPress admin Dashboard
(function(){
var request = wp.ajax.post('custom_action', {param1: 'uppercase this string pls'});
// on success
request.done( function ( res ) {
console.log( res );
});
// on fail
@westonruter
westonruter / .gitmodules
Last active November 26, 2018 21:17
Test widget plugin for WordPress issue #27491: Widget Customizer: Dynamically-created inputs cause from to replace itself without event to trigger re-initialization https://core.trac.wordpress.org/ticket/27491
[submodule "chosen"]
path = chosen
url = git@github.com:harvesthq/chosen.git
@roborourke
roborourke / wp-react-dev.php
Last active May 17, 2020 13:50
Get the development version of react in WordPress without needing a dev version of WP
<?php
/**
* Enable dev mode vendor packages.
*/
if ( ! defined( 'SCRIPT_DEBUG' ) || ! SCRIPT_DEBUG ) {
return;
}
add_action( 'init', function () {
@tlinkner
tlinkner / Output Android Icons.jsx
Last active February 19, 2021 14:15
Photoshop script to output Android icons
// Output Android Icons.jsx
// 2012 Todd Linkner
// License: none (public domain)
// v1.0
//
// This script is for Photoshop CS6. It outputs Android icons of the
// following sizes from a source PSD at least 512px x 512px
//
// store:
// Icon.png (512px x 512px)
@borkweb
borkweb / photoshop-saber-mutations.js
Last active February 27, 2021 18:59
Photoshop Script for saving lightsaber mutations with Actions
/**
* Save lightsaber mutations to different files
* Created by: Matthew Batchelder (Orv Dessrx)
* For: Dark Jedi Brotherhood https://www.darkjedibrotherhood.com
*/
if ( 0 !== app.documents.length ) {
var doc = app.documents[0];
var filename = doc.name.substring( 0, doc.name.indexOf( '.' ) );
var file;
@darkseed
darkseed / psextendscriptexample.js
Created September 29, 2011 13:25 — forked from aral/psextendscriptexample.js
Using ExtendScript to save out multiple resolution images from Photoshop (with unsharp mask)
/*
The original files are 960x319.
Image sizes to save:
* 800x266 - Retina for 480x320 resolution (400 logical pixel wide panel areas)
* 740x246 - Desktop and iPad
* 616x205 - Retina for 320x480 resolution (308 logical pixel wide panel areas)
* 400x133 - 480x320 resolution
* 308x102 - 320x480 resolution
@aral
aral / psextendscriptexample.js
Created June 4, 2011 21:04
Using ExtendScript to save out multiple resolution images from Photoshop (with unsharp mask)
/*
The original files are 960x319.
Image sizes to save:
* 800x266 - Retina for 480x320 resolution (400 logical pixel wide panel areas)
* 740x246 - Desktop and iPad
* 616x205 - Retina for 320x480 resolution (308 logical pixel wide panel areas)
* 400x133 - 480x320 resolution
* 308x102 - 320x480 resolution