Skip to content

Instantly share code, notes, and snippets.

Avatar

Arne akamola

View GitHub Profile
@akamola
akamola / Perl.sublime-build
Created Mar 15, 2013
Sublime Text 2: Build system for Perl
View Perl.sublime-build
{
"cmd": ["perl", "-w", "$file"],
"file_regex": ".* at (.*) line ([0-9]*)",
"selector": "source.perl"
}
@akamola
akamola / hashbang.sublime-snippet
Created Mar 15, 2013
Sublime Text 2: Snippet for the hashbang with the regular path to Perl
View hashbang.sublime-snippet
<snippet>
<content><![CDATA[#!/usr/bin/perl]]></content>
<tabTrigger>hashbang</tabTrigger>
<scope>source.perl</scope>
<description>#!/usr/bin/perl</description>
</snippet>
@akamola
akamola / sub.sublime-snippet
Created Mar 21, 2013
Sublime Text 2: Snippet for Perl subroutines
View sub.sublime-snippet
<snippet>
<content><![CDATA[sub ${1:function_name} {
${0:# Code ...}
}
]]></content>
<tabTrigger>sub</tabTrigger>
<scope>source.perl</scope>
<description>Subroutine</description>
</snippet>
@akamola
akamola / .gitignore
Last active Jun 15, 2019
Git: Basic ignore file (.gitignore)
View .gitignore
# Temporary files
*~
*.swp
# Metadata
.DS_Store
Thumbs.db
@akamola
akamola / gist:5654020
Last active Dec 17, 2015
Objective-C: Enumerate the objects of an array using a block (enumerateObjectsUsingBlock)
View gist:5654020
[anArray enumerateObjectsUsingBlock:^(id value, NSUInteger index, BOOL *stop) {
NSLog(@"%lu: %@", index, value);
}];
@akamola
akamola / .htaccess
Created May 31, 2013
HTACCESS: Basic configuration for web projects for Apache web servers
View .htaccess
# PHP
php_flag register_globals off
php_flag short_open_tag off
# Set default charset to UTF-8
AddDefaultCharset UTF-8
# File types
@akamola
akamola / .gitignore
Last active Feb 6, 2018
Xcode: Git ignore file for Xcode projects (.gitignore)
View .gitignore
# Temporary files
*~
*.swp
# Metadata
.DS_Store
Thumbs.db
@akamola
akamola / dateLocal.php
Last active Nov 5, 2016
MODX: Snippet for an output modifier to localize dates (see: http://goo.gl/HUpyFg)
View dateLocal.php
<?php
setlocale(LC_ALL, 'en_US');
return strftime($options, $input);
@akamola
akamola / grandparent.php
Last active Nov 5, 2016
MODX: Snippet to get the ID of the grandparent resource (see: http://goo.gl/prdscX)
View grandparent.php
<?php
$id = $modx->resource->get('id');
$parents = $modx->getParentIds($id, 2);
$grandparent = $parents[1];
return $grandparent;
@akamola
akamola / arraykeys.php
Last active Nov 5, 2016
PHP: Find all entries of an array whose keys starts with "barfoo-"
View arraykeys.php
<?php
foreach ( $foobar as $key => $value ) {
if ( preg_match('/^barfoo-/', $key) ) {
// Array entries of $foobar whose keys starts with barfoo-
}
}
You can’t perform that action at this time.