Skip to content

Instantly share code, notes, and snippets.

View drakakisgeo's full-sized avatar

Drakakis George drakakisgeo

View GitHub Profile
@drakakisgeo
drakakisgeo / gist:5f1e3eac8d0fc6dedfb0
Created May 17, 2014 15:43
Delay keyup in Jquery
*** executing a function after the user has stopped typing for a specified amount of time ***
*** From http://stackoverflow.com/questions/1909441/jquery-keyup-delay ***
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
@drakakisgeo
drakakisgeo / gist:d299d2f801d0c6e563bb
Last active August 29, 2015 14:02
Installation of Self Signed SSL in Ubuntu
### Commands that need Execution
- sudo apt-get install apache2 && a2enmod ssl && service apache2 restart && mkdir /etc/apache2/ssl
- sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt
In the second command you can change the number of days. Here is one year only.
From The questions you see after executing the second command the most important is the "Common Name". I personally put my static ip there.
- sudo nano /etc/apache2/sites-available/default-ssl.conf
@drakakisgeo
drakakisgeo / gist:d22a569feae0746baebe
Created July 10, 2014 09:10
On click Confirm popup (Jquery)
// Info: Attach event to all elements with this data attribute
// works even for elements that will be created afterwards by Ajax or Jquery
// Only thing you do is to put a data-popmsg attribute in the element you want to click and the value of this attribute
// will be the body of the popup.
$(document).on("click","*[data-popmsg]",function(e){
var msg = $(this).attr("data-popmsg");
if(!confirm(msg))
{
e.preventDefault();
@drakakisgeo
drakakisgeo / Gruntfile
Created July 25, 2014 19:20
Grunt setup for Aglio autocompile and merge .md files
#### Instructions #######################
#
# Install Node, grunt-aglio and grunt-contrib-watch on your localhost
# Create this .js file in the folder that you want Grunt to watch for changes
# Replace "my_app" with your app name
# Intro.md, first.md and any .md files will be watched. The order that those will be concatenated is in the array => ["intro.md","first.md",'second.md']
#
##########################################
@drakakisgeo
drakakisgeo / gist:bbbfb32a02afe90fe9ab
Created August 19, 2014 17:07
Custom filter to validate if ending date is less than starting date (Laravel)
// Validate End
Validator::extend('Validend', function($attribute, $value, $parameters)
{
$start_date = Input::get($parameters[0]);
return (strtotime($value) > strtotime($start_date));
});
@drakakisgeo
drakakisgeo / gist:0f50d1cf485d92b75570
Last active August 29, 2015 14:05
Web Development Conferences / Meetups in Greece
@drakakisgeo
drakakisgeo / gist:12cebcd516ffee65a746
Created September 28, 2014 16:05
Fix for SSL CURL problem ( not validated self-signed certificates)
1. Get the file cacert.pem from http://curl.haxx.se/docs/caextract.html
2. store it somewhere like /etc/php5/apache2
3. Put this line in your php.ini (/etc/php5/apache/php.ini)
curl.cainfo=/etc/php5/apache2/cacert.pem
4. All set!
@drakakisgeo
drakakisgeo / gist:2c756f2e6c1d0c3720e5
Created October 26, 2014 16:47
Preventing Cron Job Collision (File system lock file - Laravel indatus/dispatcher)
public function fire()
{
//// Preventing Cron Job Collision
$file = "/var/www/tick/cronlock";
$fp = fopen($file, 'r+');
if(!flock($fp, LOCK_EX | LOCK_NB)) {
$this->error('Cron is already running another task...');
exit(-1);
}
@drakakisgeo
drakakisgeo / gist:a6bacfaf1b15b49bc4ff
Created October 28, 2014 08:40
PhpStorm Font Rendering Ubuntu (note)
> Removed
-Dawt.useSystemAAFontSettings=lcd
> Added
-Dswing.aatext=true
-Dawt.useSystemAAFontSettings=gasp
-Dsun.java2d.xrender=true
@drakakisgeo
drakakisgeo / gist:591649190564fe57a4cd
Last active August 29, 2015 14:17
Mailcatcher Codeception Nth($num)
<?php
/**
* See In nth Email
*