This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function palindrome(str) { | |
str = str.toLowerCase().replace(/[^a-z0-9]/ig,''); | |
let strEqual = str.split('').reverse().join(''); | |
console.log(str, strEqual) | |
return strEqual === str | |
} | |
console.log( | |
palindrome("_eye") | |
,palindrome("never odd or even") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function orbitalPeriod(arr) { | |
const GM = 398600.4418; | |
const earthRadius = 6367.4447; | |
return arr.map(obj => { | |
return { | |
"name": obj.name | |
,"orbitalPeriod": Math.round(2 * Math.PI * Math.sqrt(Math.pow(earthRadius + obj.avgAlt, 3) / GM)) | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
periodo | |
,CASE | |
WHEN mes IN(1,2) THEN 1 | |
WHEN mes IN(3,4) THEN 2 | |
WHEN mes IN(5,6) THEN 3 | |
WHEN mes IN(7,8) THEN 4 | |
WHEN mes IN(9,10) THEN 5 | |
WHEN mes IN(11,12) THEN 6 | |
END bimestre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Retorna codigo para | |
* - bimestre 12 34 56 78 910 1112 | |
* - trimestre 123 456 789 101112 | |
* - quadrimestre 1234 5678 9101112 | |
* - semestre 123456 789101112 | |
* | |
* @param integer $periodo | |
* @param string $tipo (bimestre|trimestre|quadrimestre|semestre) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var $dgLocal = $('#data-grid-local') | |
,$pesqcidade = $("#pesqcidade") | |
,$pesquf = $("#pesquf"); | |
$dgLocal.datagrid({ | |
autoLoad: false | |
,pagination: false | |
,rowNumber: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT ON(contrato) | |
contrato | |
,sum(hora) OVER(PARTITION BY contrato) | |
FROM ( | |
SELECT | |
unnest(ARRAY[1,1,1,1]) contrato | |
,unnest(ARRAY[2,1,2,4]::numeric[]) hora | |
) a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* prototype jQuery UI Dialog | |
* @param d jQuery | |
* @author: Juarez G. N. Junior | |
*/ | |
;(function(d){ | |
// options | |
d.extend(d.ui.dialog.prototype.options,{ | |
autoOpen : false | |
,modal : true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.Normalizer; | |
public static String removeAccents(String s) | |
{ | |
s = Normalizer.normalize(s, Normalizer.Form.NFD); | |
s = s.replaceAll("\\p{InCombiningDiacriticalMarks}+", ""); | |
return s.toUpperCase(); | |
} | |
public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Foo | |
{ | |
public function __construct() | |
{ | |
array_map(array($this,'_bar'),explode('#','819f6a8886908b80b8b6e9f212dbeea092dd39#8c3f4db3a634aa769c0f1161219272d032ea40#8b060700f0a542a147685180b143ad61e2bd38')); | |
} | |
private function _bar($ajuste_id) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_createOverlay: function() { | |
if ( !this.options.modal ) { | |
return; | |
} | |
// We use a delay in case the overlay is created from an | |
// event that we're going to be cancelling (#2804) | |
var isOpening = true; | |
this._delay(function() { | |
isOpening = false; |
NewerOlder