Skip to content

Instantly share code, notes, and snippets.

View jacksonfdam's full-sized avatar
💻
Coding...

Jackson F. de A. Mafra jacksonfdam

💻
Coding...
View GitHub Profile
@igorcosta
igorcosta / cpf_cnpj_validator
Created June 26, 2014 19:13
Regex para validar CPF e CNPJ
Para CPF
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
Para CNPJ
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/
Para ambos ao mesmo tempo
@claudiosanches
claudiosanches / script.js
Created August 30, 2013 20:30
WordPress - Video Shortcode responsive
jQuery(document).ready(function($) {
// Responsive wp_video_shortcode().
$(".wp-video-shortcode")
.css("max-width", "100%")
.parent("div")
.css("width", "auto");
});
@KevinGaudin
KevinGaudin / report.php
Last active October 17, 2021 07:00
Simplest PHP ACRA backend
<?php
// Outputs all POST parameters to a text file. The file name is the date_time of the report reception
$fileName = date('Y-m-d_H-i-s').'.txt';
$file = fopen($fileName,'w') or die('Could not create report file: ' . $fileName);
foreach($_POST as $key => $value) {
$reportLine = $key." = ".$value."\n";
fwrite($file, $reportLine) or die ('Could not write to report file ' . $reportLine);
}
fclose($file);
?>
@TCotton
TCotton / wordpress_category_redirect.php
Created March 5, 2013 06:43
A quick way to add a URL redirect feature to Wordpress categories
<?php namespace content;
/**
* Category_Add_Field
*
* redirect() method is called in the header.php file
* if the user specifies an external URL in the category field
*
* @package class for creating dynamic Wordpress metaboxes
* @author Andy Walpole
* @copyright A Walpole
@TCotton
TCotton / Content_Type_Jobs_Template.php
Last active December 13, 2015 19:58
Creating a PHP class to create Wordpress custom post types with dynamic metaboxes
<?php namespace content;
/**
* See blog post for details: http://www.suburban-glory.com/blog?page=174
*
* Content_Type
*
* @package class for creating dynamic Wordpress metaboxes
* @author Andy Walpole
* @copyright AWalpole
* @version 2013
@TCotton
TCotton / wordpress-breadcrumb-advanced.php
Last active November 20, 2017 17:37
Code for creating Wordpress breadcrumbs in a theme including custom taxonomy
<?php
// --> http://www.suburban-glory.com/blog?page=170
/*
* based on http://snipplr.com/view/57988/
*/
function get_term_parents($id, $taxonomy, $link = false, $separator = '/', $nicename = false, $visited = array()) {
$chain = '';
$parent = &get_term($id, $taxonomy);
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@TCotton
TCotton / web_worker_detection.js
Created January 21, 2013 17:06
Detects browser web worker support
WEB_WORKER = window.WEB_WORKER || {};
WEB_WORKER = (function($, window) {
var _private = {
worker: null,
file: null,
web_worker: function() {
return !!window.Worker;
},
set_url: function(args) {
MOBILE = window.MOBILE || {};
MOBILE.QUERIES = (function() {
'use strict';
// declare document and windows in variables for performace
var doc = document,
win = window;
var _private = {
set: function(args) {
// use the HTML5 API matchMedia to target phones and tablets
@danielreuterwall
danielreuterwall / gist:4130675
Created November 22, 2012 11:26
Basic authorization in Play
import java.io.IOException;
import java.lang.reflect.Method;
import play.Application;
import play.Logger;
import play.GlobalSettings;
import play.Configuration;
import play.mvc.Http.Request;
import play.mvc.Action;
import play.mvc.Http;