Skip to content

Instantly share code, notes, and snippets.

@sepehr
sepehr / lcdhype-asus-g50-g70.txt
Last active January 19, 2016 03:20
LCDHype script for Asus G50/G70 LCDs.
#Header
%KeyInit()
%Param.AvoidPluginCleanUp()
%Common.SetPriority(140)
%Graph.SetTextArea(0,0,255,31)
%Graph.Font('OCR-A',10,1)
%DefVar(xPos,Local=105)
%DefVar(yPos,Local=16)
%DefVar(an=0)
%DefVar(km,Global)
@sepehr
sepehr / rmdir_recursive.php
Last active July 9, 2018 00:52
PHP: Recursive directory removal
<?php
/**
* Recursively removes a directory.
*
* @param string $path Directory path to remove.
* @param bool $suicide Whether to remove itself or not.
*
* @return void
*/
@sepehr
sepehr / csv_parse.php
Created September 12, 2012 14:35
PHP: Parse CSV into Keyed Array
<?php
/**
* Parses CSV file into an associative array with the first row as field names.
*
* @param string $filepath Path to readable CSV file.
* @param array $options Parse options (eol, delimiter, enclosure, escape, to_object).
*
* @return array Associative array of parsed CSV file.
*/
@sepehr
sepehr / svn_rm_deleted.sh
Last active November 10, 2015 23:08
SVN: Remove Deleted Files
svn st | grep '^!' | awk '{print $2}' | xargs svn delete --force
@sepehr
sepehr / Default(OSX).txt
Last active January 19, 2016 03:18
Sublime Settings
[
{ "keys": ["ctrl+super+a"], "command": "alignment" },
{ "keys": ["ctrl+super+f"], "command": "reindent", "args": {"single_line": false}},
{ "keys": ["super+v"], "command": "paste_and_indent" },
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["super+backspace"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete Line.sublime-macro"} },
]
@sepehr
sepehr / print_r.js
Created September 1, 2012 04:14
JS: Dump Helper (print_r)
/**
* Debug helper similar to PHP's print_r().
*
* This function was inspired by the print_r function of PHP.
* This will accept some data as the argument and return a
* text that will be a more readable version of the
* array/hash/object that is given.
*
* @param data
* array, object or hash (assoc array)
@sepehr
sepehr / array_map_assoc.php
Created September 1, 2012 02:56
PHP: Array Map Associative
<?php
/**
* Converts a linear array to its associative equivalent.
*
* @param $array
* Linear array to process.
* @param $function
* Callback name to call against each value.
*
* @return array
@sepehr
sepehr / gdipp_setting.xml
Last active July 5, 2016 10:06
Custom GDIPP Settings
<?xml version="1.0" encoding="UTF-8" ?>
<gdipp>
<version>0.9.1</version>
<gdimm>
<process>
<freetype>
<cache_max_faces>32</cache_max_faces>
<cache_max_sizes>32</cache_max_sizes>
<cache_max_bytes>4194304</cache_max_bytes>
@sepehr
sepehr / object_to_array.php
Created August 27, 2012 08:53
PHP: Recursively cast an object into array
<?php
/**
* Recursively casts an object into array.
*
* @param $object
* Object to cast to array.
*
* @return array
*/
@sepehr
sepehr / greasemonkey_template.user.js
Created August 18, 2012 17:34
Userscript Template
// ==UserScript==
// @name SCRIPT
// @description SCRIPT DESCRIPTION
// @icon https://raw.github.com/sepehr/userscript-SCRIPT/master/SCRIPT.png
//
// @author Sepehr Lajevardi <me@sepehr.ws>
// @namespace http://github.com/sepehr
// @downloadURL https://raw.github.com/sepehr/userscript-SCRIPT/master/SCRIPT.user.js
//
// @license GPLv3 - http://www.gnu.org/licenses/gpl-3.0.txt