Skip to content

Instantly share code, notes, and snippets.

View jenalgit's full-sized avatar
💭
I may be slow to respond. Lagi sibuk soalnya,,, sibuk ngopi 💃

jenal jenalgit

💭
I may be slow to respond. Lagi sibuk soalnya,,, sibuk ngopi 💃
View GitHub Profile
@jenalgit
jenalgit / lamp-ubuntu16.sh
Created March 1, 2019 08:42 — forked from lyquix-owner/lamp-ubuntu16.sh
Bash script to setup LAMP server on Ubuntu 16.04
#!/bin/bash
# Check if script is being run by root
if [[ $EUID -ne 0 ]]; then
printf "This script must be run as root!\n"
exit 1
fi
DIVIDER="\n***************************************\n\n"
@jenalgit
jenalgit / curl-verbose.php
Created February 21, 2019 13:04 — forked from hubgit/curl-verbose.php
Verbose cURL in PHP
<?php
// Request URL
$url = 'http://www.google.com/';
// HTTP headers
$headers = array(
//'Content-Type: application/json',
//'Accept: application/json',
);
@jenalgit
jenalgit / CustomBuilder.php
Created February 7, 2019 16:50 — forked from tonila/CustomBuilder.php
Mass (bulk) insert or update on duplicate for Laravel 5.x
<?php
namespace App\Classes\Database;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Arr;
class CustomBuilder extends Builder
{
public function insertOrUpdate(array $values)
@jenalgit
jenalgit / curl-post.php
Created January 20, 2019 04:59 — forked from lesstif/curl-get.php
PHP CURL POST example
<?php
class Log {
public static function debug($str) {
print "DEBUG: " . $str . "\n";
}
public static function info($str) {
print "INFO: " . $str . "\n";
}
public static function error($str) {
@jenalgit
jenalgit / HeidiDecode.js
Created January 13, 2019 07:15 — forked from jpatters/HeidiDecode.js
Decodes a password from HeidiSQL. HeidiSQL passwords can be found in the registry. Use File -> Export Settings to dump all settings. Great for if you forget a password.
function heidiDecode(hex) {
var str = '';
var shift = parseInt(hex.substr(-1));
hex = hex.substr(0, hex.length - 1);
for (var i = 0; i < hex.length; i += 2)
str += String.fromCharCode(parseInt(hex.substr(i, 2), 16) - shift);
return str;
}
document.write(heidiDecode('755A5A585C3D8141786B3C385E3A393'));
@jenalgit
jenalgit / Random-string
Created December 5, 2018 03:33 — forked from 6174/Random-string
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
@jenalgit
jenalgit / eloquent.php
Created November 28, 2018 14:40 — forked from ziadoz/eloquent.php
Laravel 4 Eloquent ORM Standalone (Observers, Query Logging).
<?php
class Post
{
protected $table = 'posts';
/**
* You can define your own custom boot method.
*
* @return void
**/
@jenalgit
jenalgit / Vagrantfile
Created November 9, 2018 00:35 — forked from ducnt0/Vagrantfile
Vagrantfile Setup for PHP 5.6
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
@jenalgit
jenalgit / simple-json-reponse.php
Created October 27, 2018 07:49 — forked from james2doyle/simple-json-reponse.php
A simple JSON response function for PHP. Used in various PhileCMS plugins.
<?php
function json_response($message = null, $code = 200)
{
// clear the old headers
header_remove();
// set the actual code
http_response_code($code);
// set the header to make sure cache is forced
header("Cache-Control: no-transform,public,max-age=300,s-maxage=900");
@jenalgit
jenalgit / AccessBehavior.php
Created October 14, 2018 12:43 — forked from r3verser/AccessBehavior.php
Yii2 Redirects all users to login page if not logged in
<?php
/*
* In configuration file
* ...
* 'as AccessBehavior' => [
* 'class' => '\app\components\AccessBehavior'
* ]
* ...
* (c) Artem Voitko <r3verser@gmail.com>