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
@pateketrueke
pateketrueke / wp-shot.php
Created August 9, 2012 23:13
Take screenshot using WP Remote API (fake)
<?php
$url = urlencode('http://wordpress.org');
$width = 200;
$request = "http://s.wordpress.com/mshots/v1/$url?w=$width";
echo "Link: $request";
@laracasts
laracasts / ex.php
Last active January 27, 2016 13:08
So you want to allow one user to "follow" another user (like Twitter-style). Using Laravel and Eloquent, what's your preference?
<?php
// Option 1: the follow method immediately references the relationship and saves it.
class User extends Eloquent {
public function follows()
{
return $this->belongsToMany(self::class, 'follows', 'follower_id', 'followed_id');
}
@bonny
bonny / with-posts-wordpress-function.php
Last active May 9, 2016 18:50
WordPress function with_posts(), that simplifies getting and looping posts, in a jQuery anonymous function-ish way. Setups global, restores post afterwards. Simple, flexible and powerful.
<?php
/**
* WordPress WP_QUERY-wrapper to simplify getting and working with posts
*
* Does something with posts, using a callback
* Setups global post variable before running callback
* And restores it afterwards
*
* An introductionary blogpost about this function is posted on our blog:
@franz-josef-kaiser
franz-josef-kaiser / image-sizes-extd.php
Last active January 24, 2017 18:29
Altering & handling default and custom wordpress image sizes and related stuff
<?php
defined( 'ABSPATH' ) OR exit;
add_action( 'init', array( 'oxoImageSizesExtd', 'init' ), 0 );
class oxoImageSizesExtd extends oxoImageSizes
{
/**
* The Class Object
* @var
@dhrrgn
dhrrgn / parse.php
Created June 19, 2013 15:32
Parsing basic Jekyll format in PHP
<?php
// Note, you need symfony/yaml to parse the Front Matter
if ( ! Input::hasFile('file'))
{
// Do some fail here
return;
}
$contents = trim(File::get(Input::file('file')->getRealPath()));
@apisznasdin
apisznasdin / Config file for sSMTP sendmail
Created January 24, 2014 08:19
Config file for sSMTP sendmail using Mandrill
#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=user@domain.com
# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.mandrillapp.com:587
@franz-josef-kaiser
franz-josef-kaiser / limit_admin_post_list_fields.php
Created July 3, 2013 13:04
Speed up the post list views in WordPress admin UI screens. Reduce the queried fields to what is needed to display the posts and what "Quick Edit" needs. Saved time increases with a higher limit set for `posts_per_screen` in the screen options drop down.
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) Faster Admin Post Lists
* Description: Reduces the queried fields inside WP_Query for WP_Post_List_Table screens
* Author: Franz Josef Kaiser <wecodemore@gmail.com>
* AuthorURL: http://unserkaiser.com
* License: MIT
*/
@unixmonkey
unixmonkey / OSX10.8 Mountain Lion Web Developer Setup Instructions
Last active March 3, 2018 19:25
My Personal Setup Instructions from fresh OSX1.8 (Mountain Lion) install:
My Personal Setup Instructions from fresh OSX1.8 (Mountain Lion) install:
Some notes on why I have chosen some of these preferences:
I am primarlily a Ruby web developer, and work on a variety of Ruby and Rails versions and database platforms.
I usually use RVM (http://rvm.beginrescueend.com), but this guide uses [chruby](https://github.com/postmodern/chruby)
I spend most of my day in the Terminal, Atom editor, and a Web Browser, and desire to keep things as simple and stock as possible, but do have certain minor preferences that make my day-to-day interaction with the computer better.
Choose Full-Disk encryption on Install and set a password
Run software update until it cannot find any updates
@franz-josef-kaiser
franz-josef-kaiser / unregister_taxonomy.php
Last active June 21, 2019 21:44
Allows unregistering built in wordpress taxonomies like 'post_tag', 'taxonomy', etc.
<?php
/**
* Plugin Name: Remove Builtin WP Taxonomies
*/
add_action( 'init', 'unregister_taxonomy' );
/**
* Remove built in taxonomies
* @author: Franz Josef Kaiser
*/
@jgable
jgable / index.js
Created September 27, 2013 19:52
Ghost Kudos Plugin Example
var fs = require('fs'),
path = require('path'),
_ = require('underscore'),
when = require('when'),
express = require('express'),
GhostPlugin = require('../../../core/server/plugins/GhostPlugin'),
knex = require('../../../core/server/models/base').Knex,
KudosPlugin;
KudosPlugin = function (ghost) {