Skip to content

Instantly share code, notes, and snippets.

View fijiwebdesign's full-sized avatar

Gabirieli Lalasava fijiwebdesign

View GitHub Profile
@fijiwebdesign
fijiwebdesign / inotifywait-execute-php.sh
Last active August 29, 2015 14:10
Watch and execute changed PHP files in a directory when they change
#!/bin/bash
#
# inotifywait-execute-php.sh
#
# Example:
# inotifywait-execute-php.sh path/to/project/
#
# Requires: https://github.com/thekid/inotify-win on windows
#
@fijiwebdesign
fijiwebdesign / ClassDelete.php
Created November 7, 2014 14:27
PHP class delete itself
<?php
class Test
{
public function delete()
{
foreach($GLOBALS as $name => $value) {
if ($GLOBALS[$name] === $this) {
unset($GLOBALS[$name]);
@fijiwebdesign
fijiwebdesign / fix-subtitle-times.php
Created November 1, 2014 20:45
Fix the times for each subtitle in a srt subtitle file
<?php
/**
* Adds the given seconds to the subtitle file
* @author [email protected]
*/
if ($argc < 2) {
echo "Usage: $argv[0] filename seconds [speed]
filename - name of subtitle file to read
seconds - amount of seconds to add to the times. If subtracting use negative values. eg: \"-5\"
@fijiwebdesign
fijiwebdesign / IsAssociativeArrayBench.php
Created November 1, 2014 19:45
Is Associative Array or Indexed Array Benchmarks.
<?php
// usage
if(!isset($argv[1])){
echo "\nUsage: ".$argv[0]." [options] iterations
Required:
iterations - Number of iterations of each test
Example:
@fijiwebdesign
fijiwebdesign / get_obj_id.php
Last active August 29, 2015 14:08
Retrieve human readable unique object Ids
<?php
/**
* @param Object $obj The Object to create an Id for
* @return String A human readable unique ID for the Object
*
* @internal Requires PHP5.2.0
* @see http://php.net/manual/en/function.spl-object-hash.php
*/
function get_obj_id($obj)
@fijiwebdesign
fijiwebdesign / inotifywait-cmd.sh
Last active May 28, 2016 04:36
Inotifywait watch files and run command
#!/bin/bash
# inotifywait-cmd.sh
#
# Example:
# inotifywait-cmd.sh test/ 'phpunit --verbose test/ModelReferencesTest.php'
#
# Requires: https://github.com/thekid/inotify-win on windows
#
# author: Gabe LG <[email protected]>
## Atom Cheatsheet.
#### Project Key Bindings.
- 'cmd-shift-p': open the command palette.
- 'cmd-p' or 'cmd-t': open the fuzzy finder to find a file.
- 'cmd-b': look for a file that is already open.
- 'cmd-shift-b': search the list of files modified and untracked in your project repository.
- 'ctrl-0': open and focus the the tree view.
- 'cmd-shift-f': find and replace in the entire project.
@fijiwebdesign
fijiwebdesign / detect-available-fonts.js
Last active February 24, 2024 15:04
Detect available fonts with JS
/**
* JavaScript code to detect available availability of a
* particular font in a browser using JavaScript and CSS.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/javascript-css-font-detect/
* License: Apache Software License 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Version: 0.15 (21 Sep 2009)
* Changed comparision font to default from sans-default-default,
@fijiwebdesign
fijiwebdesign / detect-font.jquery.js
Last active August 29, 2015 14:07
Detect font-family of element in jquery
/**
* Detects the font of an element from the font-family css attribute by comparing the font widths on the element
* @link http://stackoverflow.com/questions/15664759/jquery-how-to-get-assigned-font-to-element
*/
(function($) {
$.fn.detectFont = function() {
var fontfamily = $(this).css('font-family');
var fonts = fontfamily.split(',');
if ( fonts.length == 1 )
return fonts[0];
@fijiwebdesign
fijiwebdesign / apache2 dump modules
Created October 4, 2014 09:43
Show list of apache modules
apache2ctl -t -D DUMP_MODULES