Skip to content

Instantly share code, notes, and snippets.

View goesredy's full-sized avatar

Ida Bagus Redy Santiawan goesredy

View GitHub Profile
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
<?php
/*
DONT FORGET TO DELETE THIS SCRIPT WHEN FINISHED!
*/
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = 'webmaster@example.com';
/*
Make the Facebook Like box responsive (fluid width)
https://developers.facebook.com/docs/reference/plugins/like-box/
*/
/* This element holds injected scripts inside iframes that in some cases may stretch layouts. So, we're just hiding it. */
#fb-root {
display: none;
}
@goesredy
goesredy / gist:f968d8396d38453d3e51
Created January 29, 2016 01:22 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@goesredy
goesredy / jquery.waituntilexists.js
Created January 29, 2016 03:30 — forked from buu700/jquery.waituntilexists.js
jQuery plugin which runs handler function once specified element is inserted into the DOM
(function ($) {
/**
* @function
* @property {object} jQuery plugin which runs handler function once specified element is inserted into the DOM
* @param {function} handler A function to execute at the time when the element is inserted
* @param {bool} shouldRunHandlerOnce Optional: if true, handler is unbound after its first invocation
* @example $(selector).waitUntilExists(function);
*/
@goesredy
goesredy / laravel-ums.markdown
Created May 30, 2016 02:11 — forked from anchetaWern/laravel-ums.markdown
Building a User Management System in Laravel

There's no shortage of good resources for learning laravel. So instead of the usual introductory tutorial were just gonna learn Laravel by building a project from scratch and that's gonna be a User Management System.

I don't know if my definition of a User Management System is correct but here's my idea of what's it's capable of doing:

  • Register Roles
  • Register Users
  • Update Users
@goesredy
goesredy / facebook-sample.php
Last active July 3, 2016 04:41 — forked from daaku/facebook-sample.php
A simple Facebook PHP example.
<?php
/**
* A simple Facebook PHP example.
*
* - This is not a "Facebook SDK".
* - This example uses Curl, Hash, JSON, Session extensions.
* - This does not use the JavaScript SDK, nor the cookie set by it.
* - This works with Canvas, Page Tabs with IFrames, the Registration Plugin
* and with any other flow which uses the signed_request.
@goesredy
goesredy / batch-download.php
Created August 28, 2016 14:04 — forked from yosko/batch-download.php
Batch download files from a list of URLs into your own server and ZIP it for a easier download to your computer.
<!doctype html>
<!--
PHP Batch Download Script
@author Yosko <contact@yosko.net>
@copyright none: free and opensource
@link http://www.yosko.net/article32/snippet-05-php-telechargement-de-fichiers-par-lots
-->
<html lang="en-US">
<head>
@goesredy
goesredy / .htaccess
Created September 17, 2016 05:35 — forked from donnykurnia/.htaccess
.htaccess for 503 maintenance page
ErrorDocument 503 /index.html
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.html [R=503,L]
@goesredy
goesredy / evaldecode.php
Created September 25, 2016 02:20 — forked from yireo/evaldecode.php
Decode evil scripts encoded with eval(gzinflate(base64_decode()))
<?php
/*
* Basic script to decrypt files encoded with eval(gzinflate(base64_decode($data)));
*/
$file = 'encrypted.php';
$content = file_get_contents($file);
function evaldecode($content, $step = 0) {
//echo "STEP $step\n";