Skip to content

Instantly share code, notes, and snippets.

View dashaluna's full-sized avatar

Dasha Luna dashaluna

View GitHub Profile
@madhums
madhums / base64-image-upload.js
Created September 14, 2014 17:37
save base64 encoded image
/*
* Taken from http://stackoverflow.com/questions/5867534/how-to-save-canvas-data-to-file/5971674#5971674
*/
var fs = require('fs');
// string generated by canvas.toDataURL()
var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0"
+ "NAAAAKElEQVQ4jWNgYGD4Twzu6FhFFGYYNXDUwGFpIAk2E4dHDRw1cDgaCAASFOffhEIO"
+ "3gAAAABJRU5ErkJggg==";
// strip off the data: url prefix to get just the base64-encoded bytes
@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
@julienhay
julienhay / Redim-auto.jsx
Created February 20, 2014 17:24
Script Photoshop resize image (Portrait and Landscape auto) 1024x -> And generate miniature
// get a reference to the current (active) document and store it in a variable named "doc"
doc = app.activeDocument;
var fWidthBig = 1024;
doc.resizeImage(UnitValue(fWidthBig,"px"),null,null,ResampleMethod.BICUBIC);
var options = new ExportOptionsSaveForWeb();
options.quality = 70;
@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;
@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
@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 ) {
@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)
@stephenh1988
stephenh1988 / sh-wp-dropdown-taxonomies.php
Created June 9, 2012 20:40
A walker class to use that extends wp_dropdown_categories and allows it to use the term's slug as a value rather than ID
<?php
/*
* A walker class to use that extends wp_dropdown_categories and allows it to use the term's slug as a value rather than ID.
*
* See http://core.trac.wordpress.org/ticket/13258
*
* Usage, as normal:
* wp_dropdown_categories($args);
*
@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() )
@robnyman
robnyman / image-data-url-localStorage.js
Created February 21, 2012 08:29
Turn image into Data URL and save in localStorage
// Get a reference to the image element
var elephant = document.getElementById("elephant");
// Take action when the image has loaded
elephant.addEventListener("load", function () {
var imgCanvas = document.createElement("canvas"),
imgContext = imgCanvas.getContext("2d");
// Make sure canvas is as big as the picture
imgCanvas.width = elephant.width;