Skip to content

Instantly share code, notes, and snippets.

Fotis Evangelou fevangelou

Block or report user

Report or block fevangelou

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fevangelou
fevangelou / Timestamp in PHP for up to the minute changes.php
Created Jun 13, 2014
Timestamp in PHP for up to the minute changes
View Timestamp in PHP for up to the minute changes.php
<!-- Just because I'm bored to look at the PHP docs -->
<?php echo date('YmdHi'); ?>
View Backbone.js rewrite for Nginx.txt
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.html break;
}
}
@fevangelou
fevangelou / Equal column heights with Mootools.js
Created Dec 12, 2012
Equal column heights with Mootools
View Equal column heights with Mootools.js
window.addEvent('domready', function(){
// Equal heights for all elements with "commonClassForEachBlock" class
if($$('.commonClassForEachBlock')){
var blocks = $$('.commonClassForEachBlock');
var maxHeight = 0;
blocks.each(function(item){
maxHeight = Math.max(maxHeight, parseInt(item.getStyle('height')));
});
blocks.setStyle('height', maxHeight);
@fevangelou
fevangelou / sort_array_of_objects.php
Last active Nov 5, 2015
Sort array of objects in PHP
View sort_array_of_objects.php
// Typical method
function cmp($a, $b)
{
return strcmp($a->name, $b->name);
}
usort($your_data, "cmp");
// For PHP 5.3+ (using closures)
usort($your_data, function($a, $b){
@fevangelou
fevangelou / sendmail.conf
Last active Nov 8, 2015 — forked from adamstac/gist:7462202
Install and configure Sendmail on Ubuntu
View sendmail.conf
# Install and configure Sendmail on Ubuntu
This should help you get Sendmail installed with basic configuration on Ubuntu.
1. If sendmail isn't installed, install it: `sudo apt-get install sendmail`
2. Configure `/etc/hosts` file: `nano /etc/hosts`
3. Make sure the line looks like this: `127.0.0.1 localhost yourhostname`
4. Run Sendmail's config and answer 'Y' to everything: `sudo sendmailconfig`
5. Restart apache `sudo service apache2 restart`
@fevangelou
fevangelou / gist:beea28dcf76e2d47dd98
Created Dec 19, 2015 — forked from jgornick/gist:0b10798608193ba4fd6d
Nginx: Advanced proxy_pass depending on file exists
View gist:beea28dcf76e2d47dd98
server {
listen 443;
server_name my.domain.com;
root /var/www/my.domain.com;
ssl on;
ssl_certificate /usr/local/etc/ssl/star.crt;
ssl_certificate_key /usr/local/etc/ssl/star.key;
@fevangelou
fevangelou / javascript_resources.md
Created Oct 29, 2013 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.
View javascript_resources.md

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@fevangelou
fevangelou / css_resources.md
Created Oct 29, 2013 — forked from jookyboi/css_resources.md
CSS libraries and guides to bring some order to the chaos.
View css_resources.md

Libraries

  • 960 Grid System - An effort to streamline web development workflow by providing commonly used dimensions, based on a width of 960 pixels. There are two variants: 12 and 16 columns, which can be used separately or in tandem.
  • Compass - Open source CSS Authoring Framework.
  • Bootstrap - Sleek, intuitive, and powerful mobile first front-end framework for faster and easier web development.
  • Font Awesome - The iconic font designed for Bootstrap.
  • Zurb Foundation - Framework for writing responsive web sites.
  • SASS - CSS extension language which allows variables, mixins and rules nesting.
  • Skeleton - Boilerplate for responsive, mobile-friendly development.

Guides

@fevangelou
fevangelou / functions.php
Created Dec 30, 2015 — forked from kricore/functions.php
Greeklish permalinks for Wordpres - NOT MINE
View functions.php
<?php
// Paste this function in your theme's function.php file
function greeklish_permalinks_sanitize_title($text) {
if ( !is_admin() ) return $text;
$expressions = array(
'/[αΑ][ιίΙΊ]/u' => 'e',
'/[οΟΕε][ιίΙΊ]/u' => 'i',
'/[αΑ][υύΥΎ]([θΘκΚξΞπΠσςΣτTφΡχΧψΨ]|\s|$)/u' => 'af$1',
@fevangelou
fevangelou / wp_mass_regenerate_slugs.php
Last active Jan 9, 2016
Mass re-generate slugs in WordPress
View wp_mass_regenerate_slugs.php
<?php
/**
* Snippet for mass re-generating slugs in WordPress. Place at the bottom of wp-config.php. Backup your DB first.
*/
// We prepare a variable to hold arrays with post titles so we don't accidentally make duplicates, that would be bad
$slug_done = array();
// Run a query to grab all the posts, we only want posts/pages though
$posts = $wpdb->get_results("
You can’t perform that action at this time.