Skip to content

Instantly share code, notes, and snippets.

View sufian07's full-sized avatar
๐ŸŽ‰
Focusing

Mohammad Abu Sufian sufian07

๐ŸŽ‰
Focusing
View GitHub Profile
@sufian07
sufian07 / simple-json-api.php
Created August 1, 2016 12:13 — 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
@sufian07
sufian07 / index.js
Last active June 28, 2016 06:30
Flatten the array
/**
* This function get a nested array and return flatten format of that array
*/
function flatten(array) {
var flat = [];
for(var i = 0; i < array.length; i++) {
if(Array.isArray(array[i])) {
flat = flat.concat(flatten(array[i]));
} else {
flat.push(array[i]);