Skip to content

Instantly share code, notes, and snippets.

View ewwink's full-sized avatar

erwin solihin ewwink

View GitHub Profile
@ewwink
ewwink / functions.php
Last active December 13, 2015 22:28
Simple Login / Authentication Integration eXtplorer with your PHP Application. eXtplorer is A PHP and JavaScript- based File Manager
<?php
require_once('eXtplorer/libraries/standalone.php');
// check if session ["credentials_extplorer"] present if not redirect to "login.php"
if(!isset($_SESSION["credentials_extplorer"]["username"])){
include("login.php");
session_destroy();
exit;
}
?>
@ewwink
ewwink / browser-user-agent-list
Created February 20, 2014 08:26
List Browser User agent
Avant Browser/1.2.789rel1 (http://www.avantbrowser.com)
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.0 Safari/532.5
Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.310.0 Safari/532.9
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.514.0 Safari/534.7
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/534.14 (KHTML, like Gecko) Chrome/9.0.601.0 Safari/534.14
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.14 (KHTML, like Gecko) Chrome/10.0.601.0 Safari/534.14
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.20 (KHTML, like Gecko) Chrome/11.0.672.2 Safari/534.20
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.27 (KHTML, like Gecko) Chrome/12.0.712.0 Safari/534.27
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.24 Safari/535.1
Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.2 (KHT
@ewwink
ewwink / Detect Mobile Browser
Created February 8, 2016 09:59
Detect Mobile Browser
<?php
$useragent=$_SERVER['HTTP_USER_AGENT'];
if(preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|
@ewwink
ewwink / http_response_code.php
Created February 14, 2016 02:30
PHP Class for HTTP Response Status Codes
<?php
/**
* StatusCodes provides named constants for
* HTTP protocol status codes. Written for the
* Recess Framework (http://www.recessframework.com/)
*
* @author Kris Jordan
* @license MIT
* @package recess.http
*
@ewwink
ewwink / ytdl.user.js
Last active May 29, 2017 15:34
Adds a link on youtube pages to download the video via proxy server (YouTube-Downloader)
// ==UserScript==
// @name Youtube Downloader
// @description Adds a link on youtube pages to download the video via proxy server.
//
// @author Sepehr Lajevardi <[email protected]> modded by ewwink
// @namespace http://github.com/sepehr
//
// @version 1.1
// @license GPLv3 - http://www.gnu.org/licenses/gpl-3.0.txt
// @copyright Copyright (C) 2013, by Sepehr Lajevardi <[email protected]>
@ewwink
ewwink / Javascript HTML5 Color Picker
Last active June 21, 2017 23:44
Create Javascript HTML5 Color Picker on any page to get CSS color value
javascript:(function(){function byId(id){return document.getElementById(id)};byId("colorPicker")||(document.body.innerHTML+='<div id="colorDiv"><input id="colorPicker" type="color">&nbsp;<input id="colorResult" type="text"></div>');byId("colorDiv").style.cssText="position: fixed;bottom: 0;background-color: #ddfc09;padding: 10px;border: 2px solid #ba734c;";byId("colorPicker").addEventListener("input",function(){byId("colorResult").value=byId("colorPicker").value})})();
/*
// uncompressed version
(function() {
var byId = function(id) {
return document.getElementById(id)
}
if (!byId('colorPicker'))
document.body.innerHTML += '<div id="colorDiv"><input id="colorPicker" type="color">&nbsp;<input id="colorResult" type="text"></div>';
@ewwink
ewwink / query.sqlite
Created May 29, 2018 16:09
Firefox Delete URL History from places.sqlite by days, week, or month
-- open places.sqlite with sqlite2009 or your favorite editor then query:
-- Delete history older than 1 week
DELETE FROM moz_places WHERE datetime(last_visit_date / 1000000, 'unixepoch') < datetime('now', '-7 days')
DELETE FROM moz_historyvisits WHERE datetime(visit_date / 1000000, 'unixepoch') < datetime('now', '-7 days')
-- Delete history older than 1 month
DELETE FROM moz_places WHERE datetime(last_visit_date / 1000000, 'unixepoch') < datetime('now', '-1 month')
DELETE FROM moz_historyvisits WHERE datetime(visit_date / 1000000, 'unixepoch') < datetime('now', '-1 month')
@ewwink
ewwink / defpackage.dns-mod.java
Last active July 29, 2019 17:11
Youtube Android APK Limit Bandwidth Usage by lowering max video quality
package defpackage;
import android.content.Context;
/* renamed from: dns */
public final class dns implements dju {
private final Context a;
private final dnr b;
public final /* synthetic */ Object c_() {
@ewwink
ewwink / article-spinner.js
Created September 13, 2020 10:33
Javascript Article/Text Spinner Support Nesting
/*
*
* credit https://www.blackhatworld.com/seo/get-article-spinner-in-html-support-nesting.422056/
*
*/
function GetSpinContent(text) {
var result = text,
match,
matches,
@ewwink
ewwink / resize-images-with-javascript.html
Created June 30, 2022 19:40
Resize Image with Javascript Canvas and createImageBitmap
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Resize Image with Javascript</title>
<style>
#imgResult,
[type=text] {
width: 300px;