Skip to content

Instantly share code, notes, and snippets.

View alexalannunes's full-sized avatar
👨‍💻
I'm coding

Alex Alan Nunes alexalannunes

👨‍💻
I'm coding
View GitHub Profile
/*!
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:robert@broofa.com
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
/*
function boldText(text){
var bold = /\*\*(\S(.*?\S)?)\*\*/gm;
var html = text.replace(bold, '<b>$1</b>');
return html;
}
var result = boldText('te**st**ing');
alert(result);
@alexalannunes
alexalannunes / async-await-callback.js
Created May 2, 2019 20:00
function async/await using callback
class GitHubUser {
async data(cb) {
let users = await $.get('http://api.github.com/users/alexalannunes');
cb(users);
}
}
var user = new GitHubUser();
user.data(users => {
app.directive("corMediaSigaBadge", function() {
return {
restrict: "A",
template: `<span class="badge {{class}}">{{value}}{{showPercent ? '%' : ''}}</span>`,
scope: {
value: "=",
showPercent: "=" // boolean
},
link: function($scope, $elem, $attr) {
<?php
ini_set('display_errors',1);
ini_set('display_startup_erros',1);
error_reporting(E_ALL);
try {
$pdo = new PDO('pgsql:host=localhost;dbname=postgres', 'postgres', 'a0l11e4x23');
}
$(".summernote").summernote({
height: 300, // set editor height
minHeight: null, // set minimum height of editor
maxHeight: null, // set maximum height of editor
focus: true, // set focus to editable area after initializing summernote
codemirror: {
// codemirror options
theme: "monokai"
},
toolbar: [
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Methods: GET,HEAD,OPTIONS,POST,PUT");
header("Access-Control-Allow-Headers: Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers");
// ou
header("Access-Control-Allow-Origin: * ");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
sudo apt install xserver-xorg-core && sudo apt install xorg-input-abi-22 && sudo apt install xserver-xorg-input-libinput
<?php
define('DRIVER', 'pgsql');
define('HOST', 'localhost');
define('USER', 'postgres');
define('PASS', 'a0l11e4x23');
define('DATABASE', 'alexalannunes');
define('OPTIONS', array(
PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8",
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_OBJ,
<?php
// intervalo de datas
// 1 day
// 30 minutes
$d1 = '2019-01-01';
$d2 = '2019-01-20';
$i = 0;
while ($d1 <= $d2) {
// echo $i. '<br>';