This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // apache_request_headers replicement for nginx | |
| if (!function_exists('apache_request_headers')) { | |
| function apache_request_headers() { | |
| foreach($_SERVER as $key=>$value) { | |
| if (substr($key,0,5)=="HTTP_") { | |
| $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5))))); | |
| $out[$key]=$value; | |
| }else{ | |
| $out[$key]=$value; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Test controller extending Controller_Cambiata_REST | |
| * Jonas Nyström - cambiata | |
| * | |
| * To be used with a route like this one: | |
| * | |
| * Route::set('rest', 'rest(/<par1>(/<par2>(/<par3>(/<par4>(/<par5>)))))(.<format>)') | |
| * ->defaults(array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Quickly assemled rest controller based on Kohana 3's Kohana_Controller_REST | |
| * https://github.com/kohana/core/blob/3.1%2Fmaster/classes/kohana/controller/rest.php | |
| * | |
| * Added functionality from FuelPHP's Controller_Rest | |
| * https://github.com/fuel/fuel/blob/develop/fuel/core/classes/controller/rest.php | |
| * | |
| * All credits to Kohana and FuelPHP teams! | |
| * Jonas Nyström - cambiata |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Attempt to wrap Http Authentication into a separate class... | |
| * | |
| * Ideas and some code from FuelPHP Controller_Rest | |
| * https://github.com/fuel/fuel/blob/develop/fuel/core/classes/controller/rest.php | |
| * | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php defined('SYSPATH') or die('No direct script access.'); | |
| class Model_Bla extends ORM { | |
| public function rules() | |
| { | |
| return array( | |
| 'phone_one' => array( | |
| array('at_least', array(':validation', 1, array('phone_one', 'phone_two', 'phone_three'))), | |
| ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Make sure only root can run our script | |
| if [ "$(id -u)" != "0" ]; then | |
| echo "This script must be run as root" 1>&2 | |
| exit 1 | |
| fi | |
| # Load configuration | |
| . /etc/route53/config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript" charset="utf-8"> | |
| //Capitalize first letter while typing in side of input field | |
| jQuery(document).ready(function($) { | |
| $('#selector').keyup(function(event) { | |
| var textBox = event.target; | |
| var start = textBox.selectionStart; | |
| var end = textBox.selectionEnd; | |
| textBox.value = textBox.value.charAt(0).toUpperCase() + textBox.value.slice(1); | |
| textBox.setSelectionRange(start, end); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //method 1 | |
| import java.util.UUID | |
| uuid = UUID.randomUUID() | |
| //method 2 | |
| import static java.util.UUID.randomUUID | |
| uuid = randomUUID() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // CREATE UUID in Objective-C with ARC | |
| NSString* createUUID() | |
| { | |
| CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); | |
| CFStringRef uuidStr = CFUUIDCreateString(kCFAllocatorDefault, uuid); | |
| NSString *result = [NSString stringWithString:(__bridge NSString*)uuidStr]; | |
| CFRelease(uuid); | |
| CFRelease(uuidStr); | |
| return result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The MIT License (MIT) | |
| Copyright (c) 2014 Matteo Rinaudo | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
OlderNewer