Skip to content

Instantly share code, notes, and snippets.

View fragoulis's full-sized avatar

Yannis Fragoulis fragoulis

View GitHub Profile
@fragoulis
fragoulis / mapping
Last active December 30, 2015 02:59 — forked from icleversoft/mapping
GR_UPPERS = {
"Α" => "α", "Β" => "β", "Γ" => "γ", "Δ" => "δ", "Ε" => "ε", "Ζ" => "ζ",
"Η" => "η", "Θ" => "θ", "Ι" => "ι", "Κ" => "κ", "Λ" => "λ", "Μ" => "μ",
"Ν" => "ν", "Ξ" => "ξ", "Ο" => "ο", "Π" => "π", "Ρ" => "ρ", "Σ" => "σ",
"Τ" => "τ", "Υ" => "υ", "Φ" => "φ", "Χ" => "χ", "Ψ" => "ψ", "Ω" => "ω"
}
GR_ALPHA = [
"ἀ", "ἁ", "ἂ", "ἃ", "ἄ", "ἅ", "ἆ", "ἇ",
"Ἀ", "Ἁ", "Ἂ", "Ἃ", "Ἄ", "Ἅ", "Ἆ", "Ἇ",
@fragoulis
fragoulis / yii.activeform.ajax.js
Created January 29, 2014 13:32
Yii CActiveForm Ajax Submit
(function($){
var yiiActiveFormAjax={
beforeSend: function() {
var submit=$(this).find(':submit');
submit.prop('disabled',true);
},
complete: function(){
var submit=$(this).find(':submit');
submit.prop('disabled',false);
@fragoulis
fragoulis / YiiAutoTimestampBehavior.php
Last active August 29, 2015 13:56
Yii behavior that auto detects timestamps and applies custom conversion on their values.
<?php
class MyBehavior extends CActiveRecordBehavior
{
public to='yyyy-MM-dd';
public $from='Y-m-d';
public function beforeSave($event)
{
foreach ($this->owner->tableSchema->columns as $attribute => $column)
@fragoulis
fragoulis / unaccent.rules
Last active June 10, 2022 11:19
Postgres unaccent rules for greek characters
À A
Á A
 A
à A
Ä A
Å A
Æ A
à a
á a
â a
@fragoulis
fragoulis / ConsoleCommand.php
Last active January 16, 2018 06:18
Yii very handy console extension for logging timing and progress of an operation with colors and everything :)
<?php
/**
* Copyright 2014 John Fragkoulis
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@fragoulis
fragoulis / dropSchema.sh
Created June 10, 2014 13:50
Postgres dropdb/createdb alternative when there is no maintenance database available to connect to
set PGPASSWORD=password psql --host=host --username=username --command="drop schema public cascade;create schema public;" database
@fragoulis
fragoulis / SubmitLink.js
Created June 13, 2014 11:45
Enables clients to submit empty POST, PUT and DELETE requests using simple links.
@fragoulis
fragoulis / ext.js
Last active August 29, 2015 14:04
Useful functions that could be considered as extentions to Javascript
/**
* Given an Object it returns its length.
* Much like returning the size of an
* associative array.
*
* Usage:
* ```js
* var size = Object.size(myObject);
* ```
*
@fragoulis
fragoulis / Enum.php
Last active August 29, 2015 14:04
PHP Enumeration implementation
<?php
/**
* Enumeration base class.
*
* Clients can implement this to create commonly used enum
* structs with the use of CONSTs.
*
* Example:
* <pre>
@fragoulis
fragoulis / angular-index.html
Created July 31, 2014 18:38
Angular Bootstrap File
<!doctype html>
<html lang="en" ng-app>
<head>
<meta charset="utf-8">
<title>Page Title</title>
<!-- Bootstrap -->
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<!-- FontAwsome -->
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">