Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Reverse a CamelCase string.
*
* Examples:
* uncamel('lowerCamelCase') === 'lower_camel_case'
* uncamel('UpperCamelCase') === 'upper_camel_case'
* uncamel('ThisIsAString') === 'this_is_a_string'
* uncamel('notcamelcase') === 'notcamelcase'
* uncamel('lowerCamelCase', ' | ') === 'lower | camel | case'
@onelittlefish
onelittlefish / RKObjectManager+PutQueryParams.h
Created July 10, 2013 21:46
Category for RestKit's RKObjectManager that allows PUTs and POSTs with query parameters
//
// RKObjectManager+PutQueryParams.h
//
//
#import "RKObjectManager.h"
@interface RKObjectManager (PutQueryParams)
/**
@robinwl
robinwl / provision.sh
Last active July 3, 2017 13:33
Vagrant shell provisioner for creating a LAMP-stack
##
# Shell provisioner for LAMP
# Tested on Ubuntu 12.04
##
# Detect environment
source /etc/os-release
# Set non-interactive mode
export DEBIAN_FRONTEND=noninteractive
@vinhnx
vinhnx / fbAppInviteDelegateExample.m
Last active August 11, 2017 09:18
Example on how to determine Facebook app invite completion state
#pragma mark - Facebook App Invite Delegate
- (void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results
{
NSLog(@"app invite result: %@", results);
BOOL complete = [[results valueForKeyPath:@"didComplete"] boolValue];
NSString *completionGesture = [results valueForKeyPath:@"completionGesture"];
// NOTE: the `cancel` result dictionary will be
@dhrrgn
dhrrgn / getset.sublime-snippet
Created February 27, 2014 20:22
Sublime Text Snippet for creating a Getter/Setter in PHP.
<snippet>
<content><![CDATA[
/**
* ${1:Get the Var}
*
* @return ${2:string}
*/
public function get${3:Var}()
{
return \$this->${4:var};
@johnwards
johnwards / bootstrap.php
Created August 4, 2011 14:15
Sending emails in Silex via Swiftmailer spool
<?php
//...your silex bootstrap.
//Configure Swiftmail to use SMTP.
$app->register(new SwiftmailerExtension(), array(
'swiftmailer.options' => array(
'host' => 'smtp.gmail.com',
'port' => 465,
'username' => 'silex.swiftmailer@gmail.com',
@krusynth
krusynth / hostname.conf
Created December 6, 2012 21:20
Apache log format that shows the hostname
LogFormat "%h %l %u %t \"%m http://%{Host}i%U %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" hostnames
CustomLog "/private/var/log/apache2/access_log" hostnames
@deepakkumarnd
deepakkumarnd / server_setup.sh
Last active April 3, 2020 15:14
Server setup script
# This script has to be run as a root user
echo "* Updating system"
apt-get update
apt-get -y upgrade
echo "* Installing packages"
apt-get -y install build-essential libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop
id -u deploy &> /dev/null
if [ $? -ne 0 ]
@lordspace
lordspace / csv.php
Last active October 6, 2020 20:32 — forked from jaywilliams/csv_to_array.php
a class to read and write CSV
<?php
/**
* This class is used in Orbisius Price Changer for WooCommerce
* This premium WooCommerce extension allows you to change product prices (up/down) for all products or for a selected category and its subcategories.
* You can review them before actually making the changes.
*
* @see http://club.orbisius.com/products/wordpress-plugins/woocommerce-extensions/orbisius-woocommerce-ext-price-changer/
* @author jaywilliams | myd3.com | https://gist.github.com/jaywilliams
* @author Svetoslav Marinov (SLAVI) | http://orbisius.com
with AWS.Status;
with AWS.Response;
package Worker_Echoes.Apple.Captive is
function Service (Request : AWS.Status.Data)
return AWS.Response.Data;
end Worker_Echoes.Apple.Captive;