Skip to content

Instantly share code, notes, and snippets.

@enijar
enijar / Image.php
Created July 11, 2016 16:52
Safe Image Upload
<?php
namespace App\Soberistas\Assets;
use Intervention\Image\Constraint;
use Intervention\Image\ImageManager;
// TODO: We might want to remove this. It was added to deal with large images.
ini_set('memory_limit', -1);
#!/usr/bin/env bash
# Resize all png images in a given directory, using pngquant.
# Usage:
# bash crushPng.sh "path/to/files/"
# Check that a path has been provided from the cli.
if [ -z "$1" ]; then
echo "A path must be provided."
@enijar
enijar / package.json
Last active December 28, 2017 13:57
React + Babelify + Watchify with Node Scripts
{
"private": true,
"name": "ReactValidation",
"version": "1.0.0",
"description": "Validates form elements.",
"repository": {
"type": "git",
"url": "git@bitbucket.org:Enijar/reactvalidation.git"
},
"dependencies": {
@enijar
enijar / Parallax.js
Last active September 21, 2015 10:59
jQuery Parallax Class
var Parallax = function () {
/**
* @type {Parallax}
*/
var that = this;
/**
* Holds all of the elements and their callback
* functions inside objects.
@enijar
enijar / useful.md
Created July 29, 2015 16:00
Useful iOS Development Tools
@enijar
enijar / app.js
Created July 28, 2015 19:34
Angular Configuration File for Laravel
var app = angular.module('app', ['ngRoute']);
/**
* Define all routes and any global Angular scopes.
*
* Note: I am using the templateUrl property to refer to
* a URI for Laravel to pick up and serve, instead of
* loading a HTML file. This is a cleaner way to use
* templates with Angular and Laravel
*/
@enijar
enijar / errors.php
Last active August 29, 2015 14:08
Apache Error Codes
<?php
if (!function_exists('http_response_code')) {
function http_response_code($code = NULL) {
if ($code !== NULL) {
switch ($code) {
case 100: $text = 'Continue'; break;
case 101: $text = 'Switching Protocols'; break;
@enijar
enijar / Config.js
Last active August 29, 2015 14:07
Object-Oriented JavaScript
/**
* Cross-browser supported OOP JS class with methods
*/
// Create a class "Config". The self-invoking
// function avoids the pollution the global namespace
var Config = (function() {
// Construct
function Config() {}
@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
@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