Skip to content

Instantly share code, notes, and snippets.

@melloc01
melloc01 / check_mobile.php
Created August 28, 2014 15:22
PHP - Check mobile devices by HTTP_USER_AGENT
$android = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"android");
$ipad = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"ipad");
$iphone = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"iphone");
$ipod = strpos(strtolower($_SERVER['HTTP_USER_AGENT']),"ipod");
if ( ($android === false) && ($ipad === false) && ($iphone === false) && ($ipod === false) )
$mobile = "false";
else
$mobile = "true";
@melloc01
melloc01 / Routing VirtualHosts on Laravel 4
Last active August 29, 2015 14:06
Routing VirtualHosts on Laravel 4
/*
|--------------------------------------------------------------------------
| Routing for VirtualHosts
|--------------------------------------------------------------------------
|
| If the App receives the request
| module.laravel.com
| It is translated to
| laravel.com/module
|
//redirect to vHost
Route::group(['prefix' => 'vestibular'], function()
{
Route::any('/', function()
{
return Redirect::to('http://vestibular.laravel-lab');
});
Route::any('{all}', function($uri = "")
<?php
public function extract($entities ,array $columns = null)
{
if (!is_array($entities)) $entities = [ $entities ];
$fieldMappings = \EntityManager::getClassMetadata('Modules\Api\Entity\Product')->fieldMappings;
$associationMappings = \EntityManager::getClassMetadata('Modules\Api\Entity\Product')->associationMappings;
(function (angular) {
angular.module('app').service('StorageService', [function () {
var service = {
setItem : setItem,
getItem : getItem,
removeItem : removeItem
@melloc01
melloc01 / gist:9e6ecbee43c6110e3109
Created January 15, 2015 17:16
Popinfo directive example
<tr ng-repeat="entity in addCtrl.lastEntities" ng-class="{'success' : entity._highlight}">
<td
popinfo
popinfo-item='[{"Nome": "{{entity.name}}"},{"Categoria": "{{entity.category.name}}"}]' >
{{entity.name}}
</td>
</tr>
/**
* Setter for text
*
* @param mixed $text Value to set
*
* @return self
*/
public function setText($text)
{
angular.module
(
'common.dropzone',
[
]
<div class="form-group">
<label class="col-md-12 text-capitalize" translate >general.image</label>
<div class="col-md-6">
<div class="" ng-show="image == null">
<label class="label-dropzone" >
<input
type="file"
file-dropzone="[image/png, image/jpeg, image/gif]"
file="AddCtrl.item.image"
file-name="imageFileName"