Skip to content

Instantly share code, notes, and snippets.

@Balamir
Balamir / payu_util.php
Created June 25, 2017 17:30
PayU Utils
<?php
/**
* OpenPayU
*
* @copyright Copyright (c) 2014 PayU
*/
class OpenPayU_Util
{
/**
@Balamir
Balamir / iterm2-solarized.md
Last active June 25, 2017 15:25 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@Balamir
Balamir / Responsive.js
Created June 6, 2017 22:08 — forked from vizath/Responsive.js
Create an object that you can listen on for screen sizes with incomplete Bootstrap example.
"use strict";
var EventEmitter = require('events').EventEmitter;
var CHANGE_EVENT = 'change';
var breakpoints = [0, 768, 992, 1200, Infinity];
var indexes;
var getSize = function() {
// http://stackoverflow.com/a/11744120/808657
@Balamir
Balamir / glob_with_brackets.php
Created January 9, 2017 12:55
PHP glob() with path contains brackets "[" and "]"
<?php
/**
* glob() does not normally work if the path contains brackets "[" and "]".
* For example, this will make it fail:
* $files = glob("[myfolder]/*.txt");
* No error is returned, just an empty array!
* We need to replace that brackets with [] prefix and [] suffix.
* $files = glob("[[]myfolder[]]/*.txt");
* ta da..
**/
@Balamir
Balamir / README.md
Created December 13, 2016 21:27
Deobfuscate free version of JavascriptObfuscator.com

Simple Javascript deobfuscator

Aims to deobfuscate the result of JavascriptObfuscator free version.

Run

To tun the script, you should have had node.js installed first. Requires node.js and following npm modules:

  • esprima
@Balamir
Balamir / is_electron.js
Created November 12, 2016 20:48
JS: isElectron ?
var isElectron = (window && window.process && window.process.type === 'renderer');
if (isElectron) {
// keep Electron's require so we can load its modules
window.electronRequire = window.require;
window.electronModule = window.module;
// clear window.require so Ember can load if wrapped in Electron
// issue explained on https://github.com/atom/electron/issues/303
window.require = undefined;
window.module = undefined;
}
@Balamir
Balamir / generate_guid.php
Created October 17, 2016 20:08
Generate SQL Like GUID with PHP
<?php
function getGUID(){
if (function_exists('com_create_guid')){
return com_create_guid();
}else{
mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
$charid = strtoupper(md5(uniqid(rand(), true)));
$hyphen = chr(45);// "-"
$uuid = chr(123)// "{"
@Balamir
Balamir / get_os_and_browser.php
Created October 7, 2016 12:50
PHP: get user os and browser information
<?php
/**
* Kullanicinin kullandigi isletim sistemi bilgisini alir.
*
* @since 2.0
*/
function getOS() {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
@Balamir
Balamir / strpos_array.php
Created October 7, 2016 12:48
PHP: strpos_array is strpos that can take an array as needle
<?php
/**
* Dizi verisinin icinde, dizi olarak verilen elemanlari arar.
*
* strpos fonksiyonun array surumudur. Veriler array ya da string olabilir.
* Deger bulunamazsa false, aksi taktirde bulundugu pozisyon doner.
*
* @param array|string $haystack Icinde arama yapilacak array ya da string
* @param array|string $needles Aranacak array ya da string
* @param integer $offset
@Balamir
Balamir / py2php.py
Created June 23, 2016 10:07 — forked from reusee/py2php.py
Python to php translator, compile python script to php
import ast
from cStringIO import StringIO
import sys
INFSTR = '1e308'
def interleave(inter, f, seq):
seq = iter(seq)
try:
f(next(seq))