Skip to content

Instantly share code, notes, and snippets.

View romuloctba's full-sized avatar
:octocat:

RcDev romuloctba

:octocat:
View GitHub Profile
@netojoaobatista
netojoaobatista / String.prototype.soundex.js
Created March 22, 2012 18:00
Implementação do algorítimo SoundEX em Javascript
/**
* Implementação do algorítimo SoundEx em Javascript.
* @author João Batista Neto
*
* SoundEX é um algorítimo fonético para indexação de nomes pelo som segundo
* sua pronúncia. O algorítimo foi desenvolvido por Robert C. Russell e
* Margaret K. Odell e patenteado em 1918 e 1922.
* {@link http://en.wikipedia.org/wiki/Soundex}
*
* @return {String}
var performers;
performers = {};
async.parallel([
function(callback) {
return conductor.find({}, function(err, result) {
performers.conductor = result;
return callback(err);
});
@dansku
dansku / arduino-temperature.ino
Created May 31, 2013 03:26
Arduino LM35 Example
/*
An open-source LM35DZ Temperature Sensor for Arduino. This project will be enhanced on a regular basis
(cc) by Daniel Spillere Andrade , http://www.danielandrade.net
http://creativecommons.org/license/cc-gpl
*/
int pin = 0; // analog pin
int tempc = 0,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
@fdaciuk
fdaciuk / Esconder_console_log.md
Last active September 3, 2021 15:00
Esconder console.log() quando o site for para produção

Esconder console.log() para o site em produção

  • Trocar o www.mywebsite.com pelo endereço do site em produção;
  • Incluir isso no início do seu script.

Se passar o parâmetro ?development na URL, ele ignora e mostra os console.log().

@dhoko
dhoko / distance.js
Last active December 3, 2015 23:48
Calculer la distance en km entre deux points
/**
* Find the distance between two points
* @param {Object} pointA {lat,lng}
* @param {Object} pointB {lat,lng}
* @return {Float} Distance
*/
function howFar(pointA, pointB) {
var R,Dlat,Dlong,a,b,c,d;
var rad = function(x) {return x*Math.PI/180;}
@codescribblr
codescribblr / custom-variations-select.css
Last active January 5, 2023 20:10
Custom Select Box Replacements for Woocommerce Variations
.woocommerce.single-product .product .summary .variations {
width: 100%;
}
.woocommerce.single-product .product .summary .variations td {
display: block;
width: 100%;
}
.woocommerce.single-product .product .summary .variations td label {
font-family: 'Nunito', Helvetica, Arial, sans-serif;
letter-spacing: 0px;
// When using angular-translate it's impossible to make two-way data binding translations yet,
// and this sometimes can be a headache. So I've developed this directive to save some time.
// The view goes like this: <TAG data-bind-translate="scopeObjToTranslate.item.text"></TAG>.
angular.module('myApp', ['pascalprecht.translate']).directive('bindTranslate', [
'$translate',
'$parse',
function($translate, $parse) {

Hexo with Google search bar

@fdaciuk
fdaciuk / functions.php
Last active April 12, 2016 20:30
Adicionar mais campos no perfil de usuário do WordPress
<?php
add_filter( 'user_contactmethods', 'add_new_user_fields' );
function add_new_user_fields( $user_contact ) {
$user_contact[ 'billing_cel_phone' ] = 'Celular';
return $user_contact;
}
<?php
/**
* Use * for origin
*/
add_action( 'rest_api_init', function() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' );