Skip to content

Instantly share code, notes, and snippets.

Eric (shamai) Greenfield saltnpixels

Block or report user

Report or block saltnpixels

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bob-lee
bob-lee / polyfill-ie11-nodelist-foreach.js
Created Nov 24, 2017
Polyfill for IE11 missing NodeList.forEach
View polyfill-ie11-nodelist-foreach.js
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
@hissy
hissy / gist:7352933
Created Nov 7, 2013
[WordPress] Add file to media library programmatically
View gist:7352933
<?php
$file = '/path/to/file.png';
$filename = basename($file);
$upload_file = wp_upload_bits($filename, null, file_get_contents($file));
if (!$upload_file['error']) {
$wp_filetype = wp_check_filetype($filename, null );
$attachment = array(
'post_mime_type' => $wp_filetype['type'],
'post_parent' => $parent_post_id,
You can’t perform that action at this time.