Skip to content

Instantly share code, notes, and snippets.

@enijar
enijar / functions.php
Last active August 29, 2015 14:00
List all images in a directory recursively.
<?php
function list_all_images($path)
{
$array = array();
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($path),
RecursiveIteratorIterator::SELF_FIRST
);
@enijar
enijar / gist:14e6bf8bc0e0fe6880d2
Last active August 29, 2015 14:06
PHP AJAX Form Helper Functions
<?php
/**
* JSON response builder, useful for AJAX request
* forms. Provides a nice way to send messages
* back to the view
*
* @param $type
* @param $message
*/
@enijar
enijar / Cache.php
Last active August 29, 2015 14:06
Memcache Helper Class
<?php
/**
* Helper class for storing and fetching cache
* data by passing through keys. Setting up
* Memcache tutorial: http://code.tutsplus.com/tutorials/turbocharge-your-website-with-memcached--net-23939
*/
class Cache
{
@enijar
enijar / Imagick.php
Created September 20, 2014 17:14
Imagick
<?php
sudo apt-get install php5-imagick
@enijar
enijar / ImagickServiceProvider.php
Created September 21, 2014 14:47
Wrapper class for Imagick extension for PHP.
<?php
class ImagickServiceProvider {
// Image objects
protected $image;
protected $header;
protected $imagick;
protected $imagickDraw;
protected $imagickPixel;
@enijar
enijar / footer.php
Last active November 23, 2021 10:19
Minify JavaScript and CSS Files
@enijar
enijar / plugins.md
Last active August 25, 2022 02:24
Useful
@enijar
enijar / snippets.scss
Last active August 29, 2015 14:07
SASS Snippets
/*BACKGROUND SIZE COVER */
@mixin cover-background( $path )
{
background-image: url( "../../" + $path );
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $path + "', sizingMethod='scale')";
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="", sizingMethod="scale");
}
/* BACKGROUND GRADIENT */
@mixin background-gradient($startColor: #3C3C3C, $endColor: #999999)
@enijar
enijar / commands.sh
Created October 8, 2014 16:36
Useful Terminal Commands
# Convert video to GIF using ffmpeg
ffmpeg -i input.mp4 -pix_fmt rgb24 output.gif
@enijar
enijar / jquery.pulgin.js
Created October 18, 2014 13:14
jQuery Plugin Boilerplate
/*!
* jQuery plugin boilerplate
*
* Inspiration:
* http://msdn.microsoft.com/en-us/scriptjunkie/ff608209
* http://www.learningjquery.com/2007/10/a-plugin-development-pattern
* http://shichuan.github.com/javascript-patterns/
*
* Author: Aki Karkkainen/@akikoo
* Licensed under the MIT license