Skip to content

Instantly share code, notes, and snippets.

View attacomsian's full-sized avatar
🌱
Fore Studio

Atta ✨ attacomsian

🌱
Fore Studio
View GitHub Profile
@cvan
cvan / HOWTO.md
Last active May 7, 2024 15:23
How to serve a custom HTTPS domain on GitHub Pages with CloudFlare: *FREE*, secure and performant by default

Instructions

CloudFlare is an awesome reverse cache proxy and CDN that provides DNS, free HTTPS (TLS) support, best-in-class performance settings (gzip, SDCH, HTTP/2, sane Cache-Control and E-Tag headers, etc.), minification, etc.

  1. Make sure you have registered a domain name.
  2. Sign up for CloudFlare and create an account for your domain.
  3. In your domain registrar's admin panel, point the nameservers to CloudFlare's (refer to this awesome list of links for instructions for various registrars).
  4. From the CloudFlare settings for that domain, enable HTTPS/SSL and set up a Page Rule to force HTTPS redirects. (If you want to get fancy, you can also enable automatic minification for text-based assets [HTML/CSS/JS/SVG/etc.], which is a pretty cool feature if you don't want already have a build step for minification.)
  5. If you
@SatyaSnehith
SatyaSnehith / Converter.java
Last active May 4, 2024 08:06
Convert Bytes to KB, MB, GB, TB - java
public class Converter{
static long kilo = 1024;
static long mega = kilo * kilo;
static long giga = mega * kilo;
static long tera = giga * kilo;
public static void main(String[] args) {
for (String arg: args) {
try {
System.out.println(getSize(Long.parseLong(arg)));
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active May 3, 2024 12:55
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@hootlex
hootlex / laravellocal.md
Last active May 3, 2024 08:06
Run laravel project locally

##Windows users:

cmder will be refered as console

##Mac Os, Ubuntu and windows users continue here:

  • Create a database locally named homestead utf8_general_ci
@pcgeek86
pcgeek86 / Car Manufacturers.json
Last active April 30, 2024 15:28
Plain-text list of major car manufacturers
[
"Abarth",
"Alfa Romeo",
"Aston Martin",
"Audi",
"Bentley",
"BMW",
"Bugatti",
"Cadillac",
"Chevrolet",
@abatko
abatko / US Zip Code Geolocations from 2018 Government Data
Last active April 26, 2024 00:48
All US zip codes with their corresponding geolocations (latitude and longitude coordinates). Comma delimited for your database goodness. Source: https://www.census.gov/geographies/reference-files/time-series/geo/gazetteer-files.html > ZIP Code Tabulation Areas > Download the ZIP Code Tabulation Areas Gazetteer File
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158327, -66.932928
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.447538, -66.557681
00622,17.991245, -67.153993
<!-- Modified from https://gist.github.com/NicholasKimuli/2b167ca1c6ce03cb860e3f89d17db1eb
Bonaire, Saba and Sint Eustatius may need a future flag update -->
<select class="input-block-level" id="countryCode" name="countryCode">
<option data-countryCode="AF" value="93">&#x1F1E6&#x1F1EB Afghanistan (+93)</option>
<option data-countryCode="AL" value="355">&#x1F1E6&#x1F1FD Albania (+355)</option>
<option data-countryCode="DZ" value="213">&#x1F1E9&#x1F1FF Algeria (+213)</option>
<option data-countryCode="AD" value="376">&#x1F1E6&#x1F1E9 Andorra (+376)</option>
<option data-countryCode="AO" value="244">&#x1F1E6&#x1F1F4 Angola (+244)</option>
<option data-countryCode="AI" value="1264">&#x1F1E6&#x1F1EE Anguilla (+1264)</option>
<option data-countryCode="AG" value="1268">&#x1F1E6&#x1F1EC Antigua &amp; Barbuda (+1268)</option>
@v0lkan
v0lkan / nginx.conf
Last active April 2, 2024 18:25
Configuring NGINX for Maximum Throughput Under High Concurrency
user web;
# One worker process per CPU core.
worker_processes 8;
# Also set
# /etc/security/limits.conf
# web soft nofile 65535
# web hard nofile 65535
# /etc/default/nginx
@howkymike
howkymike / currency-dropdown.html
Last active March 17, 2024 23:36
HTML Dropdown Currency List. Compatibile with ISO 4217 standard and extended with the currencies not included in the ISO 4217 but used commercially.
<select id="currencyList">
<option value="USD" selected="selected" label="US dollar">USD</option>
<option value="EUR" label="Euro">EUR</option>
<option value="JPY" label="Japanese yen">JPY</option>
<option value="GBP" label="Pound sterling">GBP</option>
<option disabled>──────────</option>
<option value="AED" label="United Arab Emirates dirham">AED</option>
<option value="AFN" label="Afghan afghani">AFN</option>
<option value="ALL" label="Albanian lek">ALL</option>
<option value="AMD" label="Armenian dram">AMD</option>
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter