Skip to content

Instantly share code, notes, and snippets.

View Mallinanga's full-sized avatar

Panos Paganis Mallinanga

  • VG web things
  • Athens, Greece
View GitHub Profile
@Mallinanga
Mallinanga / wp.php
Created December 8, 2013 13:06
WordPress Media Library rename files
<?php
if ( !defined( 'ABSPATH' ) ) {
exit;
}
add_action( 'init', 'rename_media_files_init' );
function rename_media_files_init() {
add_filter( 'attachment_fields_to_edit', 'rename_media_files_fields_to_edit', 11, 2 );
add_filter( 'attachment_fields_to_save', 'rename_media_files_attachment_fields_to_save', 11, 2 );
}
@Mallinanga
Mallinanga / maintenance.html
Last active December 26, 2015 23:09
Scheduled interruption of our services
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Scheduled interruption of our services</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Scheduled interruption of our services"/>
<style type="text/css">
body, td{
font-size: 14px;
font-family: Arial, sans-serif;
@Mallinanga
Mallinanga / asset.html
Created October 13, 2013 07:14
imessage from html
<a href="imessage://your@appleid.com">Send iMessage to a Mac</a>
<a href="sms://your@appleid.com">Send iMessage to iOS</a>
@Mallinanga
Mallinanga / s.js
Created June 4, 2013 19:42
#jquery Facebook like & share counts
(function ($) {
$.fn.fblikecount = function (options) {
var defaults = {
baseUrl: 'http://graph.facebook.com/?ids='
// Likes
// baseUrl: 'http://graph.facebook.com/
};
var options = $.extend(defaults, options);
var count = 0;
return this.each(function () {
@Mallinanga
Mallinanga / s.sh
Created March 31, 2013 14:27
#shell Minify images
#!/bin/bash
base_path=__PATH__
if type -P jpegtran &>/dev/null; then
echo 'Running jpegtran';
find $base_path -iname "*.jpg" -type f -exec jpegtran -outfile '{}' -copy none -optimize -progressive '{}' \;
else
echo 'jpegtran not found';
fi
if type -P pngcrush &>/dev/null; then
echo 'Running pngcrush';
@Mallinanga
Mallinanga / s.js
Created March 25, 2013 11:08
#jquery Style file inputs
(function ($) {
$.fn.filestyle = function (options) {
var settings = {
width: 250
};
if (options) {
$.extend(settings, options);
}
return this.each(function () {
var self = this;
@Mallinanga
Mallinanga / s.css
Created March 15, 2013 07:46
#css WebKit scrollbar
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar:horizontal {
display: none;
}
::-webkit-scrollbar-track {
margin-top: 20px;
margin-bottom: 20px;
border-width: 21px 0;
@Mallinanga
Mallinanga / s.sql
Created March 14, 2013 21:19
#db Alter database/table charset/collation
ALTER DATABASE __databasename__ DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE __tablename__ CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
@Mallinanga
Mallinanga / s.rb
Last active October 12, 2015 10:48
#ruby Splendid Bacon create administrator
rails console
Admin.create(email: "__email__", password: "__password__", password_confirmation: "__password__")