Skip to content

Instantly share code, notes, and snippets.

@amdrade
amdrade / getMimeTypefromString
Created Oct 30, 2020 — forked from jmaciasportela/getMimeTypefromString
Get mimeType from file extension as string
View getMimeTypefromString
//Mime types. Some keys are duplicated.
array(
".3dm"=>"x-world/x-3dmf",
".3dmf"=>"x-world/x-3dmf",
".a"=>"application/octet-stream",
".aab"=>"application/x-authorware-bin",
".aam"=>"application/x-authorware-map",
".aas"=>"application/x-authorware-seg",
".abc"=>"text/vnd.abc",
@amdrade
amdrade / git-apply-patch.md
Created Nov 6, 2018 — forked from emmanueltissera/git-apply-patch.md
Generate a git patch for a specific commit
View git-apply-patch.md

Creating the patch

git format-patch -1 <sha>
OR
git format-patch -1 HEAD

Applying the patch

git apply --stat file.patch # show stats.
git apply --check file.patch # check for error before applying

@amdrade
amdrade / fc-fixed-column.css
Created Oct 15, 2018
Full Canlendar com coluna de horários fixa para visão dia
View fc-fixed-column.css
.table-responsive .fixed-column {
position: absolute;
display: inline-block;
width: auto;
border-right: 1px solid #ddd;
opacity: 0;
top: 0;
z-index: 3;
background: #fff;
color: #2d2d2d;
@amdrade
amdrade / cURL_auth.php
Last active Apr 4, 2020
PHP: Exemplo cURL com autenticação HTTP básica
View cURL_auth.php
<?php
// index.php
<?php
$aDados = ['item1' => 'value1', 'item2' => 'value2', 'dados' => ['a','b','c']];
$username = 'user';
$password = 'pass';
$sUrl = 'http://localhost/projetos/estudos/php/curl/response.php/?item3=value3&item4=value4';
$sHttpBuildQuery = http_build_query($aDados);
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, $sUrl );
@amdrade
amdrade / fn.php
Created Sep 29, 2017
Funções PHP
View fn.php
function generateUrl() {
$protocol = $_SERVER['SERVER_PORT'] == '443' ? 'https' : 'http';
$uri = $_SERVER['REQUEST_URI'];
$Url = $protocol.'://'.str_replace('//', '/', $_SERVER['SERVER_NAME'].'/'.$uri);
return $Url;
}
@amdrade
amdrade / fn.js
Last active Nov 12, 2017
Funções JS
View fn.js
function generateUrl() {
var location = window.location,
url = window.location.href;
if (location.protocol == 'https:') {
url = 'https:' + location.href.substring(location.protocol.length);
}
return url;
}
function hasClass(el, className) {
You can’t perform that action at this time.