Skip to content

Instantly share code, notes, and snippets.

View Zenger's full-sized avatar
⌨️
=

Dennis Zenger Zenger

⌨️
=
View GitHub Profile
@Zenger
Zenger / elementaryos-peerflix-magnet
Created May 23, 2015 09:59
Peerflix Magnet Link Elementary OS Fix
#!/bin/bash
pantheon-terminal -e "peerflix \"$1\" -v --clean"
sleep 1
rm -rvf /tmp/torrent-stream/*
#Assuming that you're using panthon-terminal and you have installed nodejs and peerflix
#Save this file as a script, paste it anywhere, chmod u+x on it.
#In your browser click on a magnet link, point it to your new script and voila
#NOTE: !!! You can use xterm instead of pantheon-terminal if you like.
@Zenger
Zenger / Envato.php
Created January 28, 2015 07:41
A small wrapper for Envato's API. You can use this to check if a user bought an item from you.
<?php
class Envato
{
protected static $key = "";
protected static $username = "";
public static function verify( $code )
<?php
/* Plugin Name: X-Frame-Options
Description: Simple X-Frame-Options Manager
Author: Zenger
Author URI: http://1theme.com/
*/
$setting = "http://themeforest.net/";
// IMPORTANT ! Use "wp_enqueue_media()" to enqueue the media manager
/*
Usage :
Media( jQuery('my-element'), { title: "Select" } , function(img) {
// do something with the img (note for multiple is going to be an array!)
});
*/
function Media(element, settings, cb)
{
this.settings = jQuery.extend({
@Zenger
Zenger / envato-class.php
Created January 23, 2014 07:37
Confirm user license key on envato marketplaces
<?php
class Envato
{
protected static $key = "";
protected static $username = "";
public static function verify( $code )
@Zenger
Zenger / move-files.php
Created January 23, 2014 07:32
Small class for moving whole directory structures. Unlike other solutions it builds up an array with directory structure. Possibly buggy :)
<?php
class LazyRecursiveMove
{
var $files = array();
var $dest = array();
var $from = "";
var $to = "";
function build_move_array( $from , $to, $parent = "" )
@Zenger
Zenger / gwf.php
Created January 23, 2014 07:20
Generate a list of webfonts from google.
<?php
define('APIKEY', 'your-api-key');
$request = file_get_contents('https://www.googleapis.com/webfonts/v1/webfonts?key='. APIKEY);
$fh = fopen('list.txt', 'w');
fwrite($fh, $request);
fclose($fh);
$content = json_decode($request) ;
@Zenger
Zenger / options.php
Created January 22, 2014 07:22
A class for the lazy to add options to the general screen
<?php
class sOption {
var $field;
public function __construct( $name = 'setting', $label = 'Your Setting', $type = 'text', $screen = 'general' )
{
$this->field->name = $name;
$this->field->type = $type;
$this->field->screen = $screen;
@Zenger
Zenger / search-replace-db.php
Last active December 29, 2015 17:19
Search and replace db 2 modified. A modified version of interconnectit.com tool. Modified to support json_encoded strings. Can search and replace in regular strings, serialized strings and json_encoded strings.
<?php
/**
* @modified: Zenger
* Safe Search and Replace on Database with Serialized Data v2.0.1b
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
@Zenger
Zenger / WP Utils.php
Last active May 10, 2022 07:43
A small class with usefull functions in it.
<?php
class Utils
{
public static function init()
{
self::header_cleanup();
}
public static function header_cleanup()