Skip to content

Instantly share code, notes, and snippets.

View ZachMoreno's full-sized avatar

Zachariah Moreno ZachMoreno

View GitHub Profile
@ZachMoreno
ZachMoreno / Detect_Brave_Browser.js
Created July 8, 2019 01:45
The Brave Browser removed "Brave" from its User-Agent in v0.9. DuckDuckGo can detect Brave & this promise utilizes their API to detect Brave.
const detectBraveBrowser = () => {
return new Promise((resolve, reject) => {
if(!navigator.userAgent.includes('Chrome')) { return resolve(false); }
const xhr = new XMLHttpRequest();
const onload = () => {
if(xhr.status >= 200 && xhr.status < 300) {
const response = JSON.parse(xhr.responseText);
if(!response) { return resolve(false); }
@ZachMoreno
ZachMoreno / list.css
Created March 20, 2014 23:03
Continue ordered list item numbering with CSS counter
ol.start {
counter-reset: mainSection;
}
ol.split {
list-style-type: none;
}
ol.split li:before {
counter-increment: mainSection;
@ZachMoreno
ZachMoreno / square_thumbnail.php
Created February 21, 2012 07:34
Create Square Thumbnails
<?php
function create_square_thumbnails($userfile_name, $userfile_type)
{
//get the file and figure out what type of file it is and some of its attributes
switch ($userfile_type)
{
case "image/pjpeg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break;
case "image/jpeg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break;
case "image/jpg": $tempbig = imagecreatefromjpeg(IMG_PATH.$userfile_name); break;
case "image/gif": $tempbig = imagecreatefromgif(IMG_PATH.$userfile_name); break;
<!doctype html>
<html>
<head>
<title>Google Map Example</title>
<style>
html,
body,
#my-map {
height: 100vh;
(function() {
var doc = document.documentElement;
doc.setAttribute('data-useragent', navigator.userAgent);
})();
<ul class="unstyled-list">
<li>list item</li>
<li><a href="#" alt="">list item</a></li>
<li>
<strong>list item</strong>
<ul>
<li>sub list item</li>
<li>sub list item</li>
</ul>
</li>
<div class="container">
<div class="row">
<div class="column-11 push-1">
<p>.push-1</p>
</div> <!-- end .column-1 -->
</div> <!-- end .row -->
<div class="row">
<div class="column-10 push-2">
<p>.push-2</p>
<div class="container">
<div class="row">
<div class="column-12">
<p>.column-12</p>
<div class="row gutters">
<div class="column-4">
<p>.column-4</p>
</div> <!-- end .column-4 -->
<div class="container">
<div class="row gutters">
<div class="column-1">
<p>.column-1</p>
</div> <!-- end .column-1 -->
<div class="column-11">
<p>.column-11</p>
</div> <!-- end .column-11 -->
</div> <!-- end .row -->
<div class="container">
<div class="row">
<div class="column-1">
<p>.column-1</p>
</div> <!-- end .column-1 -->
<div class="column-11">
<p>.column-11</p>
</div> <!-- end .column-11 -->
</div> <!-- end .row -->