Skip to content

Instantly share code, notes, and snippets.

View andreiluca's full-sized avatar

Andrei Luca andreiluca

View GitHub Profile
@oliverservin
oliverservin / install_mariadb_serverpilot.md
Last active November 15, 2016 01:01
How to Upgrade MySQL 5.5 to MariaDB 10.1 on Ubuntu 14.04 and ServerPilot
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable
sudo invoke-rc.d apparmor restart
sudo replace log_slow_queries slow_query_log_file -- /etc/mysql/conf.d/mysqld_slow_log.cnf
sudo bash -c 'echo "slow_query_log = 1" >> /etc/mysql/conf.d/mysqld_slow_log.cnf'
sudo apt-get purge --assume-yes mysql-server mysql-server-5.5 mysql-server-core-5.5 mysql-client mysql-client-5.5 mysql-client-core-5.5
sudo apt-get autoremove --assume-yes
sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb [arch=amd64,i386] http://mariadb.mirror.anstey.ca/repo/10.1/ubuntu trusty main'
<?php
/**
* Plugin Name: NGINX FastCGI cache purge
* Version: 0.1
* Description: Flush NGINX FastCGI cache purge
* Author: The Shipyard Crew
* Author URI: https://theshipyard.se/
* Plugin URI: https://theshipyard.se/
* Text Domain: nginx-fastcgi-cache-purge
@bappi-d-great
bappi-d-great / code.php
Created February 4, 2015 09:53
User Registration to Subscription (wpmu)
<?php
/*
Plugin Name: User Registration to Subscription (wpmu)
Plugin URI: http://bappi-d-great.com
Description: This plugin allows your users to auto subscribe when registered
Author: WPMU DEV
Version: 1.0.1
Author URI: http://bappi-d-great.com
*/
@andiraduta
andiraduta / gist:7591955
Created November 21, 2013 23:37
Quicklink tool in caz ca site-ul 2Parale este nefunctional
<?php
session_start();
$user_2p = ''; // your 2parale user
$pass_2p = ''; // your 2parale pass
function get_page($link) {
global $user_2p, $pass_2p;
$ch = curl_init($link);
@andiraduta
andiraduta / gist:7493431
Created November 15, 2013 23:25
Ia lista de campanii cu lead-uri din 2Parale (ordonate crescator dupa valoarea lead-ului)
<?php
function recursive_campaigns($api_url, &$campaigns, &$page) {
global $url;
$response = file_get_contents($api_url);
$json_obj = json_decode($response);
if( count($json_obj) > 1 ) {
foreach($json_obj as $obj) {
if( $obj->campaign->default_lead_commission_rate != "" ) {
@davoclavo
davoclavo / vine_hasher.rb
Last active October 15, 2016 20:56
tool to unhash/hash vine ids
module VineHasher
VINE_KEY = 'BuzaW7ZmKAqbhMOei5J1nvr6gXHwdpDjITtFUPxQ20E9VY3Ll'
VINE_KEY_SIZE = VINE_KEY.size
VINE_KEY_HASH = VINE_KEY.split('').each_with_index.inject({}) {|hash, (key, index)| hash[key] = index; hash }
def unhash_id(hashed_id)
hashed_id.reverse.split('').each_with_index.inject(0) { |total, (key, index)| total + VINE_KEY_HASH[key] * VINE_KEY_SIZE**index }
end
def hash_id(id)
anonymous
anonymous / gist:4436930
Created January 2, 2013 19:01
PHP code to display the top 10 posts from 9GAG using the InfiniGAG API.
<?php
$jsonurl = "http://infinigag.eu01.aws.af.cm/";
$json = file_get_contents($jsonurl,0,null,null);
$json_output = json_decode($json, TRUE);
foreach($json_output['images'] as $key => $thisValue)
{
$arrayImage = $thisValue['image'];
$title = $thisValue['title'];
$url = $thisValue['url'];
@burke
burke / x.md
Created December 4, 2012 22:31
Dealing with Github notifications

Or, How I took back my inbox

I've been getting a lot of Github notifications lately. Between work at Shopify, development on Zeus, and all the little things in between, my inbox usually has about 50 github notifications in it.

This is a little annoying.

The problem is, I care about most of those notifications the moment they happen, but I don't interact with them as emails -- I go to github as soon as I get the email and deal with it there. Most of my other email, I don't care so much about it immediately, but it's fairly important that I actually read them eventually. What this tends to cause is a flood of unread notification emails drowning out the important stuff, which I end up ignoring if it falls off the first page.

The solution to this problem for me ended up being really trivial (I didn't even have to code anything!)

@wutupake
wutupake / url_only.php
Created November 7, 2012 18:22
WP: Next/Previous Post URL only
<?php if (get_adjacent_post(false, '', false)): // if there are newer posts ?>
<a href="<?php echo get_permalink(get_adjacent_post(false,'',false)); ?>" class="article-nav prev">&nbsp;</a>
<?php endif; ?>
<?php if (get_adjacent_post(false, '', true)): // if there are older posts ?>
<a href="<?php echo get_permalink(get_adjacent_post(false,'',true)); ?>" class="article-nav next">&nbsp;</a>
<?php endif; ?>
@malarkey
malarkey / Contract Killer 3.md
Last active May 17, 2024 15:28
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………