Skip to content

Instantly share code, notes, and snippets.

View flangofas's full-sized avatar
🎯
Focusing

Antonis Flangofas flangofas

🎯
Focusing
View GitHub Profile
@flangofas
flangofas / alias-list.php
Created August 3, 2016 14:30
Creating alias out of given name
<?php
$items = [
'Aluminium Manufacturing',
'Cement Manufacturing',
'Chemicals',
'Chemicals - Fertilizers',
'Chemicals - Methanol',
'Construction',
'Contract Laboratory Services',
'Education',
@flangofas
flangofas / MimeTypeTrait.php
Last active May 9, 2016 09:11
MIME types trait
<?php
namespace App\Traits;
trait MimeTypeTrait
{
/**
* MIME Types
*
* @link http://stackoverflow.com/questions/6654351/check-file-uploaded-is-in-csv-format#answer-13032788
* @link http://www.rfc-editor.org/rfc/rfc3778.txt
@flangofas
flangofas / isempty.php
Created March 9, 2016 10:49
Cakephp 3 - isEmpty example
public function index($sliderId = null)
{
$exists = $this->Slides->Sliders->exists(['id' => $sliderId]);
if (!$exists) {
throw new RecordNotFoundException(__('Cannot find the provided slider'));
}
$this->paginate = [
'contain' => ['Sliders']
];
$query = $this->Slides
@flangofas
flangofas / imgloader.js
Last active August 29, 2015 14:22
Image Loader
/**
* Image loader
*/
var ImageLoader = function() {
//Constructor
};
/**
* This function can be used to load heavy images(when page is loaded)
* or dynamic images which we don't want to load with their container at once.
@flangofas
flangofas / sublime.json
Last active August 29, 2015 14:22
Sublime settings
{
"color_scheme": "Packages/Dayle Rees Color Schemes/sublime/contrast/solarflare-contrast.tmTheme",
"font_size": 10.0,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": 1,
"line_padding_top": 1
}
@flangofas
flangofas / vimrc.vimrc
Created May 28, 2015 12:24
My vim config
syntax on
set number
set wrap
set laststatus=2 " Always show the statusline
set title " Set the title of the window in the terminal to the file
set history=500 " History
set backup
"Followin cmd must be configure with X11
set clipboard+=unnamed " Yank to system clipboard
set showcmd " Display an incomplete command in the lower right corner of the Vim window
@flangofas
flangofas / git-config
Created May 28, 2015 12:22
git config
[user]
name = Antonis Flangofas
email = antonisflags@gmail.com
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
@flangofas
flangofas / aliases.sh
Last active August 29, 2015 14:22
Favorite aliases
#Bring current branch up to date with master one
alias git-sync="git checkout master && git pull origin master && git checkout - && git merge master"
@flangofas
flangofas / local-storage.html
Created March 12, 2015 22:17
Simple example of local storage - HTML5 API
<!DOCTYPE html>
<html lang="en">
<head>
<title>Web Storage Example</title>
<meta charset="UTF-8" />
<script>
window.addEventListener('load', function(event) {
var key = document.getElementById('key');
var value = document.getElementById('value');
var add = document.getElementById('add');
<?php
// CORE/app/models/datasources/json_source.php
/**
* JSON Source module for CakePHP.
*
* @package cake
*/