Skip to content

Instantly share code, notes, and snippets.

View zrrtcs's full-sized avatar

Aizzat Suhardi zrrtcs

  • Kuala Lumpur, Malaysia
View GitHub Profile
@odan
odan / xampp_php7_xdebug.md
Last active October 13, 2025 22:45
Installing Xdebug for XAMPP
@fernandosavio
fernandosavio / delayedForEach.js
Last active May 30, 2022 06:44
An Array forEach with a delay between steps.
/**
* An array forEach with a delay between steps.
*
* @param {Function} callback Function to execute for each element. It receives three arguments, the element value, the element index and the array being traversed, respectivily.
* @param {Number} timeout Number of milliseconds that the function call should be delayed by.
* @param {Object} thisArg Object to use as this when executing callback.
* @this {Array}
* @return {undefined}
*/
Array.prototype.delayedForEach = function(callback, timeout, thisArg){
@shuujii
shuujii / mac-suspend
Created July 26, 2012 00:30
Deep sleep and restore default hibernatemode on Mac
#!/bin/bash
PLIST=~/Library/LaunchAgents/my.resume.plist
RESUME=$(cd $(dirname $0); pwd)/mac-resume
machine_suspend() {
cat <<EOF > $PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@penguinboy
penguinboy / Object Flatten
Created January 2, 2011 01:55
Flatten javascript objects into a single-depth object
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;