Skip to content

Instantly share code, notes, and snippets.

View LogIN-'s full-sized avatar
:electron:
Working from space

LogIN-

:electron:
Working from space
  • WWW
View GitHub Profile
@LogIN-
LogIN- / utf8_arabic.php
Created October 4, 2014 11:19
PHP detect UTF8 && arabic encoding
<?php
function detect_utf_encoding($data) {
$UTF32_BIG_ENDIAN_BOM = chr(0x00) . chr(0x00) . chr(0xFE) . chr(0xFF);
$UTF32_LITTLE_ENDIAN_BOM = chr(0xFF) . chr(0xFE) . chr(0x00) . chr(0x00);
$UTF16_BIG_ENDIAN_BOM = chr(0xFE) . chr(0xFF);
$UTF16_LITTLE_ENDIAN_BOM = chr(0xFF) . chr(0xFE);
$UTF8_BOM = chr(0xEF) . chr(0xBB) . chr(0xBF);
$first2 = substr($data, 0, 2);
@LogIN-
LogIN- / numb_html.php
Created October 4, 2014 11:13
PHP convert number to html code
<?php
/*====================================*/
/*=== Determine numbers HTML codes ===*/
/*====================================*/
function NumbertoHtmlCodes($number){
$number = (int)$number;
if ($number === 0) {
$html = "&#48;";
}elseif ($number === 1) {
$html = "&#49;";
@LogIN-
LogIN- / mail_att.php
Created October 4, 2014 11:12
PHP send email with attachment
<?php
/*====================================*/
/*=== Send email with attachment ====*/
/*====================================*/
function mail_attachment($to, $subject, $message, $from, $file, $reply_to) {
// $file should include path and filename
$filename = basename($file);
$file_size = filesize($file);
$content = chunk_split(base64_encode(file_get_contents($file)));
$uid = md5(uniqid(time()));
@LogIN-
LogIN- / zip.php
Created October 4, 2014 11:10
PHP create ZIP Archive function
<?php
/* creates a compressed zip file */
function create_zip($files = array(), $destination = '', $overwrite = false) {
//if the zip file already exists and overwrite is false, return false
if(file_exists($destination) && !$overwrite) { return false; }
//vars
$valid_files = array();
//if files were passed in...
if(is_array($files)) {
//cycle through each file
@LogIN-
LogIN- / numb_words.php
Created October 4, 2014 11:09
PHP Convert numbers to words
<?php
function ThreeDigitsInWords($Number){
if ($Number == 0){
return "";
}
$InWords = "";
$Units_Place = array("zero","one","two","three","four","five","six","seven","eight","nine");
$Tens_Place = array(1=>"ten","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety");
@LogIN-
LogIN- / portcheck.cc
Last active August 29, 2015 14:07
Check free port node native addon
#include <node.h>
#include <v8.h>
#include <stdio.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
@LogIN-
LogIN- / bindingQT.gyp
Created September 30, 2014 13:41
including flags for QT framework simple in binding.gyp - node native module. If error possible solution is to add path: export LD_LIBRARY_PATH=/home/xxx/Qt/5.3/gcc/lib/
{
"targets": [{
"target_name": "CutyCapt",
"sources": ["CutyCapt.cc"],
'conditions': [
['OS=="linux"', {
'cflags': [
'-fPIC',
'-std=c++11',
'<!@(pkg-config --cflags Qt5Core Qt5Svg Qt5WebKit Qt5WebKitWidgets Qt5Network)'
@LogIN-
LogIN- / node_mouse.cc
Created September 30, 2014 11:49
Node native module control mouse position coordinates
#include <node.h>
#include <v8.h>
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
using namespace node;
using namespace v8;
#!/bin/bash
wget -q -O - https://mail.google.com/a/gmail.com/feed/atom --http-user=${1} --http-password="${2}" --no-check-certificate | grep -oP '(?<=<fullcount>).*?(?=</fullcount>)'
@LogIN-
LogIN- / nice_svg_js.circle.html
Created May 19, 2014 18:53
Javascript countdown circle
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Pure Javascript CountDown</title>
<meta name="description" content="Pure Javascript CountDown">
<meta name="author" content="FlopUp.Net">
<style type="text/css">