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
@TCotton
TCotton / doodle.js
Created July 16, 2011 18:17
Using doodle.js HTML Canvas framework
function html5_canvas() {
// declare variables
var $canvas, $element, $circle, $rect, $triangle, $x, $limit, $angle, $centerY, $range, $speed;
//dom block element wrapper
$element = doodle.createDisplay("canvas");
//creates new canvas element wrapper
$canvas = $element.createLayer();
// function to create a random number
@grifo
grifo / fizzbuzz-fibo.js
Created August 2, 2012 12:05
Desafios do Code n' Bier de 01 agosto de 2012
function fizzbuzz(a, b) {
for (var i = a; i <= b; i++) {
if (i % 3 == 0 && i % 5 == 0) {
console.log("Fizzbuzz");
} else if (i % 5 == 0) {
console.log("Buzz");
} else if (i % 3 == 0) {
console.log("Fizz");
} else {
console.log(i);
@henriquemoody
henriquemoody / sql_formater.php
Created August 7, 2012 00:12 — forked from augustohp/sql_formater.php
SQL formater for PHP by @alganet
function formatSql($sql) {
return preg_replace(
'/(select|from|(left |right |natural |inner |outer |cross |straight_)*join|where|limit|update |set|insert |values)/i',
"\n$1\n ", str_replace("\n", '', $sql)
);
}
@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;
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
@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) {
@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_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
@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");
});
@TCotton
TCotton / fabric.js
Created July 14, 2011 19:14
Creates pretty shapes with fabric.js
function html5_canvas() {
// declear variables
var $canvas, $rect, $circle, $triangle, $i, $limit, $width, $height;
//create canvas object with div id
$canvas = new fabric.Canvas('canvas_1');
// create Circle - note radius