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
<?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");
$(".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
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');
}
app.directive("corMediaSigaBadge", function() {
return {
restrict: "A",
template: `<span class="badge {{class}}">{{value}}{{showPercent ? '%' : ''}}</span>`,
scope: {
value: "=",
showPercent: "=" // boolean
},
link: function($scope, $elem, $attr) {
@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 => {
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);
/*!
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:[email protected]
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
/*