Skip to content

Instantly share code, notes, and snippets.

View geminorum's full-sized avatar
🏠
Working from home

Nasser Rafie geminorum

🏠
Working from home
View GitHub Profile
<?php
use Illuminate\Support\Contracts\ArrayableInterface;
use Illuminate\Support\Contracts\JsonableInterface;
class Excel implements ArrayableInterface, JsonableInterface{
protected $objPHPExcel;
public function __construct($file){
if($file instanceof \SplFileInfo){
$filename = $file->getRealPath();
@geminorum
geminorum / classJson.php
Created August 22, 2014 22:00
simple class wrapper for encoding and decoding JSON via : http://phpfashion.com/how-to-encode-and-decode-json-in-php
<?php
class Json
{
private static $messages = array(
JSON_ERROR_DEPTH => 'The maximum stack depth has been exceeded',
JSON_ERROR_STATE_MISMATCH => 'Syntax error, malformed JSON',
JSON_ERROR_CTRL_CHAR => 'Unexpected control character found',
JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON',
5 /*JSON_ERROR_UTF8*/ => 'Invalid UTF-8 sequence',
6 /*JSON_ERROR_RECURSION*/ => 'Recursion detected',
@geminorum
geminorum / minify.php
Created August 28, 2014 08:49
A set of regular expressions in PHP to minify a string of CSS. https://github.com/GaryJones/Simple-PHP-CSS-Minification/
<?php
/**
* Quick and dirty way to mostly minify CSS.
*
* @since 1.0.0
* @author Gary Jones
*
* @param string $css CSS to minify
* @return string Minified CSS
*/
This build uses Google's Closure Compiler solely for its error output, allowing you to use NppExec
for a quick syntax sanity check while editing JavaScript files, using F6 to cycle through any syntax
errors the compiler flags up.
To add the build:
1. Install NppExec plugin using Plugin Manager or download it from http://bit.ly/tHIUs and restart Notepad++
2. Download the Closure compiler.jar from http://code.google.com/closure/compiler/ and place it somewhere
on your computer. An easy place to do so is to save it directly to C:\ to avoid path issues.
3. On Notepad++ hit F6
@geminorum
geminorum / sksort.php
Last active August 29, 2015 14:07 — forked from alkavan/sksort.php
<?php
/**
* A function to sort data array element by one or two sub keys, both directions
*/
function sksort(&$array, $subkey = "id", $subkey2 = null ,$sort_ascending=false)
{
if (count($array))
$temp_array[key($array)] = array_shift($array);
.genericon-rotate-90 {
-webkit-transform: rotate(90deg);
-moz-transform: rotate(90deg);
-ms-transform: rotate(90deg);
-o-transform: rotate(90deg);
transform: rotate(90deg);
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);
}
.genericon-rotate-180 {
/*
* Lets you use your browser's back/forward buttons for in-page navigation by
* adding custom 'next' and 'previous' events to the window object.
*
* Copyright (c) 2011 Tobias Schneider <schneider@jancona.com>
* This script is freely distributable under the terms of the MIT license.
*
* Example:
*
* window.addEventListener('next', function(){
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@geminorum
geminorum / ajax-form.js
Last active August 29, 2015 14:10 — forked from havvg/ajax-form.js
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@geminorum
geminorum / Foo.php
Last active August 29, 2015 14:11 — forked from chrisguitarguy/Foo.php
<?php
class Foo
{
private $name;
private static $defaultInstance = null;
/**
* Public constructor: create as many instance as you want
*/