Skip to content

Instantly share code, notes, and snippets.

View fazlurr's full-sized avatar

Fazlur Rahman fazlurr

View GitHub Profile
@fazlurr
fazlurr / WP_Query_Args.php
Last active March 18, 2024 23:14 — forked from billerickson/gist:3698476
WP_Query arguments list
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
import android.util.Log;
import java.util.Arrays;
/**
* RC4+ Encryption - from Stack Overflow
* Stack Overflow : http://stackoverflow.com/a/12290876
* Original Code : https://code.google.com/p/a9cipher/source/browse/src/com/a9development/a9cipher/RC4.java?r=1b5bdf2a70b3ef8cc9464f8a31332a2ec9f54e7a
*/
@fazlurr
fazlurr / ContentEditor.vue
Last active December 14, 2023 21:19
tiptap alignment And custom image handler
<template>
<!-- WYSIWYG Editor -->
<div class="editor mb-4">
<editor-menu-bar class="editor-bar" :editor="editor">
<div slot-scope="{ commands, isActive, focused, getMarkAttrs }">
<!-- Image -->
<label
class="btn btn-plain mb-0"
:class="{ 'is-loading': isUploading }"
v-tooltip="'Add Image'">
<script>
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.createTemplateTagFirstArg=function(f){return f.raw=f};$jscomp.createTemplateTagFirstArgWithRaw=function(f,g){f.raw=g;return f};
(function(f){var g=function(d,a,c){c=void 0===c?!1:c;a||(a=window.location.href);d="[?&]"+d.replace(/[\[\]]/g,"\\$&")+"(=([^&#]*)|&|#|$)";a=(c?new RegExp(d):new RegExp(d,"i")).exec(a);if(!a)return null;if(!a[2])return"";a=(a=a[2].replace(/\+/g," "))?decodeURIComponent(a.replace(/%(?![0-9][0-9a-fA-F]+)/g,"%25")):a;return a=a.replace(/[&<>="#;]/g,"")},l=function(d){d+="=";for(var a=document.cookie.split(";"),c=0;c<a.length;c++){for(var b=a[c];" "===b.charAt(0);)b=b.substring(1,b.length);if(0===b.indexOf(d))return b.substring(d.length,
b.length)}return null},m=function(d,a){var c=encodeURIComponent,b=function(e){return e+"="+d[e]};(void 0===a?0:a)&&(b=function(e){return c(e)+"="+c(d[e])});return Object.keys(d).map(b).join("&")};setTimeout(function(){var d=f;d=void 0===d?"oo-link":d;var a=g("fbclid"),c=l("fbp"),b=l("fbc");d=docume
@fazlurr
fazlurr / example-wp-list-table.php
Created February 27, 2014 00:36 — forked from paulund/example-wp-list-table.php
Example WP List Table Class
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@fazlurr
fazlurr / canvas-upload.php
Created March 27, 2014 07:20 — forked from xjamundx/canvas-upload.php
Function to save base64 image to png with PHP
<?php
// requires php5
define('UPLOAD_DIR', 'images/');
$img = $_POST['img'];
$img = str_replace('data:image/png;base64,', '', $img);
$img = str_replace(' ', '+', $img);
$data = base64_decode($img);
$file = UPLOAD_DIR . uniqid() . '.png';
$success = file_put_contents($file, $data);
print $success ? $file : 'Unable to save the file.';
@fazlurr
fazlurr / read-excel.php
Created September 30, 2022 07:23
Read Excel in PHP
<?php
use Shuchkin\SimpleXLSX;
...
$file = $request->file('file');
$file_path = $file->getRealPath();
if ( $xlsx = SimpleXLSX::parse($file_path) ) {
$rows = $xlsx->rows();
@fazlurr
fazlurr / noCache.js
Created August 1, 2016 04:31
No cache in Node.js Server - http://stackoverflow.com/a/30453242
// var app = express()
app.use(function (req, res, next) {
res.header('Cache-Control', 'private, no-cache, no-store, must-revalidate');
res.header('Expires', '-1');
res.header('Pragma', 'no-cache');
next()
});
@fazlurr
fazlurr / ImageUpload.java
Last active July 19, 2022 11:46
Android Image Upload Using MultipartEntity Builder
private String updateProfile(Map map) {
File image = (File) map.get(KEY_IMAGE);
File background = (File) map.get(KEY_BACKGROUND);
FCUser user = (FCUser) map.get(KEY_USER);
String userJsonString = user.toJSONUpdate().toString();
// TODO : Change HTTPClient to HttpUrlConnection or Android Async HTTP and Upload Image
HttpClient httpClient = new DefaultHttpClient();
// Degrees to Radians
export const degsToRads = deg => (deg * Math.PI) / 180.0;
// Radians to Degrees
export const radsToDegs = rad => rad * 180 / Math.PI;
// Round like PHP Function
export const round = (num, dec) => {
var num_sign = num >= 0 ? 1 : -1;
return parseFloat((Math.round((num * Math.pow(10, dec)) + (num_sign * 0.0001)) / Math.pow(10, dec)).toFixed(dec));