Skip to content

Instantly share code, notes, and snippets.

Alen Abdula alenabdula

Block or report user

Report or block alenabdula

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
View preloadImages.js
preloadPhotographs() {
let photos = this.photographs;
let preloaded = new Array();
photos.forEach(photo => {
let image = new Image();
image.src = photo.source;
image.onload = () => {
preloaded.push(image);
if (preloaded.length === photos.length) {
this.loading = false;
View wordpress.php
<?php
/**
* Get User Metadata.
*/
$user_id = wp_get_current_user()->ID;
$user_data = get_user_meta($user_id);
var_dump($user_data);
/*
View sublime-user-setting.json
{
"ignored_packages":["Vintage"],
"overlay_scroll_bars": "enabled",
"line_padding_top": 3,
"line_padding_bottom": 3,
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"indent_guide_options": [ "draw_normal", "draw_active" ],
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"theme": "Material-Theme.sublime-theme",
View sublime-issues.md

Sublime Issues

1. Color Scheme & Theme

Issue: User-Preferences JSON file color_scheme and theme revert back to original Monokai and Default theme.

Possible: Issue with Sublime, Material theme or other package updates, need to check!

Hardware & Software:

View laravel-elixir-gulpfile.js
'use strict';
const gulp = require('gulp');
const elixir = require('laravel-elixir');
elixir( (mix) => {
mix.browserSync({
files: ['./resources/templates/**/*.twig'],
proxy: 'example.dev'
});
View prevent-access-wordpress-folder.htaccess
# Deny all access if user is not logged into WordPress
#
#
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} ^.*$
RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in.*$ [NC]
RewriteRule . - [R=403,L]
View CustomFieldSuite.php
<?php
/**
* File field returning ID
*/
if ( get_post_meta($post->ID, 'ENTER_KEY', true) ) {
$id = $cfs->get('ENTER_KEY');
$src = wp_get_attachment_image_src($id, 'large');
$alt = get_post_meta($id, '_wp_attachment_image_alt', true);
echo '<img src="' . esc_url($src[0]) . '" alt="' . $alt . '">';
@alenabdula
alenabdula / jQueryFunctions.js
Created May 16, 2016
Collection of random jQuery stuff!
View jQueryFunctions.js
/**
* Display all images without ALT tag
*/
var images = jQuery('img');
images.each(function(index, value) {
var el = jQuery(this);
var attr = el.attr('alt');
if ( typeof attr !== typeof undefined && attr !== false ) {
if ( attr === '' ) {
@alenabdula
alenabdula / Console.md
Created May 14, 2016
List of useful terminal commands
View Console.md

List of useful commands

  1. find . -type d -name 'node_modules' | xargs rm -r - removes all node_modules folders recursively.
View get_id_from_attachment_url.php
<?php
/**
* Retrive ID from attachment URL
* Source http://philipnewcomer.net/2012/11/get-the-attachment-id-from-an-image-url-in-wordpress/
*/
function get_id_from_attachment_url($attachment_url = '') {
global $wpdb;
You can’t perform that action at this time.