Skip to content

Instantly share code, notes, and snippets.

View Swipe.js
(function(){ //Self executing, anonymous function
//Leave out above if including in already existing script
function Swipe(){
var firstX, lastX;
function swipeRight(){
View color-thief-example.js
// 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);
View 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
@waqasy
waqasy / upload2facebook
Created Oct 24, 2015 — forked from nseo/upload2facebook
A sample code to upload an image file to facebook using Facebook javascript sdk
View upload2facebook
<!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 / facebook.js
Created Oct 24, 2015 — forked from koolay/facebook.js
facebook share
View facebook.js
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 / social.js
Created Oct 24, 2015
Facebook Login
View social.js
/**
* @author www.juliocanares.com/cv
* @email juliocanares@gmail.com
*/
var getJSUserData, loginUser, postToFacebook;
getJSUserData = function (callback) {
FB.getLoginStatus((function (response) {
if (response.status === "connected") {
View file_get_contents_curl.php
<?php
// http://25labs.com/alternative-for-file_get_contents-using-curl/
function file_get_contents_curl($url, $retries=5)
{
$ua = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)';
if (extension_loaded('curl') === true)
{
@waqasy
waqasy / wp-db.tutorial.php
Created Jul 28, 2016 — forked from benbalter/wp-db.tutorial.php
WordPress DB Tutorial
View wp-db.tutorial.php
<?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 / simple-json-api.php
Created Aug 6, 2016 — forked from daggerhart/simple-json-api.php
Simple Read-Only JSON API example for WordPress
View simple-json-api.php
<?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 / pug-bomb.php
Created Aug 6, 2016 — forked from retgef/pug-bomb.php
Pug Bomb API Endpoint WordPress Plugin
View pug-bomb.php
<?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{