Skip to content

Instantly share code, notes, and snippets.

angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;
@bruno-barros
bruno-barros / access another database from Wordpress
Created February 14, 2014 22:52
access another database from Wordpress
$newdb = new wpdb('root', '', 'sig001', 'localhost');
$l = $newdb->get_results("SELECT * FROM sig_contents WHERE content_type = 'sigsystem' ORDER BY title");
d($newdb->show_errors());
if($l){
foreach($l as $r){
d($r->title);
}
}
@bruno-barros
bruno-barros / functions.js
Created October 29, 2012 12:34
JS: popula cidades 'meucms'
/**
* POPULA COMBOBOX CIDADES
* @param UF : string do estado 'RJ'
* @param CIDID : ID da cidade
* @param obj_target : ID do select da cidade
* Ex: <input type="text" name="cep" id="cep" data-uf-id="uf" data-cidade-id="cidade" data-bairro-id="bairro" data-logradouro-id="logradouro" />
*/
function populaCidades(UF, CIDID, obj_target) {
myAj = $.ajax({
type: "POST",
@bruno-barros
bruno-barros / JS replaceAll
Last active February 28, 2022 02:40
JS: replaceAll
/**
* substitui strings >> replaceAll(str, '.', ':');
* @param string : string utilizada
* @param token : termo buscado
* @param newtoken : termo irá substituir
*/
function replaceAll(string, token, newtoken) {
while (string.indexOf(token) != -1) {
string = string.replace(token, newtoken);
}
@bruno-barros
bruno-barros / jQuery Boilerplate
Created October 29, 2012 03:22
JS: jQuery Boilerplate
;(function ( $, window, undefined ) {
// undefined is used here as the undefined global variable in ECMAScript 3 is
// mutable (ie. it can be changed by someone else). undefined isn't really being
// passed in so we can ensure the value of it is truly undefined. In ES5, undefined
// can no longer be modified.
// window and document are passed through as local variables rather than globals
// as this (slightly) quickens the resolution process and can be more efficiently
// minified (especially when both are regularly referenced in your plugin).