Skip to content

Instantly share code, notes, and snippets.

View mingomax's full-sized avatar
🏠
Working from home

Domingos Teruel mingomax

🏠
Working from home
View GitHub Profile
@mingomax
mingomax / Custom.css
Last active December 21, 2015 04:09 — forked from bentruyman/Custom.css
TomorowTheme for Google Developer Tools
/**********************************************/
/*
/* Darker Skin by Darcy Clarke - 2011
/*
/* For how to install, or more themes, check out:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
/* Color scheme is based on Joe Bergantine's Specials Board:
/* http://joebergantine.com/werkstatt/seestyle
/*
@mingomax
mingomax / .htaccess
Created July 9, 2013 20:08
Gave more security an instance of WordPress
# Make sure these directives are either above the "BEGIN WordPress"
# line or below the "END WordPress" line. Also, make sure you test
# your site if you use any of the suggestions below. These rules
# are very specific to running WordPress so if you also serve some other
# static or PHP files under the directory where these rules will live
# you may find they won't work. TEST TEST TEST.
# disable directory browsing
Options All -Indexes
@mingomax
mingomax / functions.php
Created June 25, 2013 20:44
Como impedir que um usuário que não seja administrador altere o status de Post quando este já foi publicado #wordpress
<?php
function wp_restrict_editing( $allcaps, $cap, $args ) {
//Only for non Admin users
if(!current_user_can('administrator')) {
// Load the post data:
$post = get_post( $args[2] );
// Bail out if the post isn't published'
if( 'publish' != $post->post_status)
return $allcaps;
}
@mingomax
mingomax / functions.php
Created June 10, 2013 19:07
This snippet show a filter to add or change the upload dir for a CPT
<?php
function post_type_dir( $param ){
$screen = get_current_screen();
$mydir = '/'.$screen->post_type;
$param['path'] = $param['path'] . $mydir;
$param['url'] = $param['url'] . $mydir;
return $param;
}
# install xcode via App Store first! It takes awhile
# install the command-line tools as well
# install growl from App Store
# eclipse/android
open http://www.eclipse.org/downloads/packages/eclipse-classic-42/junor
open http://developer.android.com/tools/sdk/eclipse-adt.html
# homebrew
@mingomax
mingomax / upload.php
Created February 4, 2013 12:23
Using PHP SDK from Facebook to upload a photo.
<?php
if(isset($_FILES["source"]["name"]))
{
try {
$facebook->setFileUploadSupport(true);
$response = $facebook->api(
'/me/photos/',
'post',
array(
'message' => $_POST['message'],
@mingomax
mingomax / gist:3778561
Created September 24, 2012 21:37
Silex Get POSt
$app->post('/api/authenticate/authorize/', function() use($app) {
$data = $app['request']->get('data');
print_r(array('data' => $data));
});
@mingomax
mingomax / ModuleBasedNavigation.php
Created April 11, 2012 03:52
Zpf_Controller_Plugin_ModuleBasedNavigation
<?php
/**
* Registra objeto Zend_Navigation e disponibiliza para uso em:
* - Menus
* - Sitemap
* - Breadcrumbs
* Ja aplica as regras de ACLs
*
* @author Domingos Teruel <dteruel@primesoft.inf.br>
*
@mingomax
mingomax / dicas
Created November 28, 2011 15:24
Teste se um Elemento HTML Existe com e sem Jquery
/*Com JQuery */
if( $('#id_do_elemento').length ) {
//Codigo
}
/* metodo tradicional sem JQuery */
if(document.getElementById('id_do_elemento') != null)
{
//Codigo
}
@mingomax
mingomax / atualiza.sh
Created November 22, 2011 15:43
Atualizar openSUSE 11.4 para 12.1
#!/bin/bash
cp -rfv /etc/zypp/repos.d /etc/zypp/repos.d.old
sed -i 's/11.4/12.1/g' /etc/zypp/repos.d/*
zypper ref && zypper dup