Skip to content

Instantly share code, notes, and snippets.

<?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
@waqasy
waqasy / pug-bomb.php
Created August 6, 2016 09:03 — forked from retgef/pug-bomb.php
Pug Bomb API Endpoint WordPress Plugin
<?php
/*
Plugin Name: Pug Bomb API Endpoint
Description: Adds an API endpoint at /api/pugs/$n_pugs
Version: 0.1
Author: Brian Fegter
Author URL: http://coderrr.com
*/
class Pugs_API_Endpoint{
@waqasy
waqasy / simple-json-api.php
Created August 6, 2016 08:14 — forked from daggerhart/simple-json-api.php
Simple Read-Only JSON API example for WordPress
<?php
/**
* Class Simple_Json_Api
*/
class Simple_Json_Api {
/**
* The top level argument for the endpoint.
* ex http://example.com/myjson/post/1
@waqasy
waqasy / wp-db.tutorial.php
Created July 28, 2016 12:15 — forked from benbalter/wp-db.tutorial.php
WordPress DB Tutorial
<?php
//absolute path to wp-load.php, or relative to this script
//e.g., ../wp-core/wp-load.php
include( 'trunk/wp-load.php' );
//grab the WPDB database object, using WP's database
//more info: http://codex.wordpress.org/Class_Reference/wpdb
global $wpdb;
@waqasy
waqasy / social.js
Created October 24, 2015 18:54
Facebook Login
/**
* @author www.juliocanares.com/cv
* @email juliocanares@gmail.com
*/
var getJSUserData, loginUser, postToFacebook;
getJSUserData = function (callback) {
FB.getLoginStatus((function (response) {
if (response.status === "connected") {
@waqasy
waqasy / facebook.js
Created October 24, 2015 18:53 — forked from koolay/facebook.js
facebook share
var Share = {};
Share.fb = function (link, title, sumary, image, winWidth, winHeight) {
var shareUrl = 'https://www.facebook.com/dialog/feed?';
shareUrl += 'app_id=141676832590601';
shareUrl += '&link=' + encodeURIComponent(link);
shareUrl += '&picture=' + encodeURIComponent(image);
shareUrl += '&name=' + title;
shareUrl += '&caption=' + "";
shareUrl += '&description=' + sumary;
@waqasy
waqasy / upload2facebook
Created October 24, 2015 16:21 — forked from nseo/upload2facebook
A sample code to upload an image file to facebook using Facebook javascript sdk
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Hello FB</title>
</head>
<body>
<div id="fb-root"></div>
<div id="fb-content"></div>
<div>
@waqasy
waqasy / RGB-Hex.js
Last active August 29, 2015 14:20 — forked from Arahnoid/RGB-Hex.js
///////////////////////////////////////////////////////////////////////////////////
/// Colection of RGB to HSB, HSB to RGB convert functions
/// Source: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
///////////////////////////////////////////////////////////////////////////////////
/**
* componentToHex convert two digit htx value to R, G or B chanel value
* @param number c value from 0 to 225
* @return string value of R, G or B chanel
* @usage //alert (componentToHex(255)); //ff
// Include Color Thief Script
// https://github.com/lokesh/color-thief
function colorChange(){
//Be sure to include <img id="coverImage" src="" alt=""/>
var $myImage = $("#coverImage");
var colorThief = new ColorThief();
//Grabs 8 swatch color palette from image and sets quality to 5 (0 =slow, 10=default/fast)
var cp = colorThief.getPalette($myImage[0], 8, 5);
(function(){ //Self executing, anonymous function
//Leave out above if including in already existing script
function Swipe(){
var firstX, lastX;
function swipeRight(){