Skip to content

Instantly share code, notes, and snippets.

View darkterminal's full-sized avatar
🕺
Dancing While Coding

Imam Ali Mustofa darkterminal

🕺
Dancing While Coding
View GitHub Profile
@darkterminal
darkterminal / bearer-token.php
Created May 17, 2022 07:38 — forked from wildiney/bearer-token.php
PHP - How to get and set Bearer Token
<?php
/**
* Get hearder Authorization
* */
function getAuthorizationHeader(){
$headers = null;
if (isset($_SERVER['Authorization'])) {
$headers = trim($_SERVER["Authorization"]);
}
else if (isset($_SERVER['HTTP_AUTHORIZATION'])) { //Nginx or fast CGI
@darkterminal
darkterminal / skeleton.css
Created May 6, 2022 08:09
Skeleton Loader CSS
/* The loading Class */
.loading {
position: relative;
background-color: #e2e2e2;
}
/* The moving element */
.loading::after {
display: block;
content: "";
@darkterminal
darkterminal / normalizeWhitespaceCharacters.php
Last active February 18, 2022 19:15
Normalize Whitespace Characters using PHP
<?php
//grepper php normalize whitespace characters
function normalizeWhitespaceCharacters( $string )
{
$stepOne = htmlentities($string);
$stepTwo = trim(preg_replace('/(&nbsp;)+|\s\K\s+/','', $stepOne));
$final = html_entity_decode($stepTwo);
return $final;
}
@darkterminal
darkterminal / example.php
Created January 27, 2022 09:13 — forked from rohit00082002/example.php
Markdown Limited - a small, fast, safe markdown function in PHP
<?php
require('markdown_limited.php');
//header('Content-Type: text/plain; charset=UTF-8');
$text = file_get_contents('sample.txt');
print markdown_limited($text);
?>
<style type="text/css">
/* Don't judge me */
@darkterminal
darkterminal / QRLogo.php
Created January 23, 2022 06:43 — forked from NTICompass/QRLogo.php
QR Code + Logo Generator
<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@darkterminal
darkterminal / directprinting.php
Created August 29, 2021 21:33 — forked from anestan/directprinting.php
direct printing php dot matrix
<?php
//set printing option to raw
$tmpdir = sys_get_temp_dir(); # ambil direktori temporary untuk simpan file.
$file = tempnam($tmpdir, 'ctk'); # nama file temporary yang akan dicetak
$handle = fopen($file, 'w');
$condensed = Chr(27) . Chr(33) . Chr(4);
$bold1 = Chr(27) . Chr(69);
$bold0 = Chr(27) . Chr(70);
$initialized = chr(27).chr(64);
@darkterminal
darkterminal / License Sublime Text 3.2.2.md
Created April 8, 2021 16:01 — forked from nobojithalder/License Sublime Text 3.2.2.md
License for Sublime Text Version 3.2.2, Build 3211

If anyone's looking for a solution for licensing Sublime Text!

Here goes an easy tutorial on how to register, Sublime Text Version 3.2.2, Build 3211

  • Go to https://hexed.it/
  • Click on "Open file" and select "sublime_text.exe" executable file. [This 'sublime_text.exe' file should be located at C:\Program Files\Sublime Text 3]
  • Go to "Search" and in "Search for" field, search for "97 94 0D" and click "Search now" button.
  • One result will appear below, click on it.
@darkterminal
darkterminal / RecieptPrinter.php
Last active March 20, 2021 09:16
ESC/POS PHP Printer
<?php
use Mike42\Escpos\CapabilityProfile;
use Mike42\Escpos\PrintConnectors\DummyPrintConnector;
use Mike42\Escpos\Printer;
class RecieptPrinter {
/* Create divider */
protected $divider;
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
<IfModule mod_php5.c>
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
</IfModule>