Skip to content

Instantly share code, notes, and snippets.

View gildotdev's full-sized avatar
🗨️
#BLM

gil.dev gildotdev

🗨️
#BLM
View GitHub Profile
public class Colors
{
private const string COLOR_WHITE = "white";
private const string COLOR_BLACK = "black";
public static string GetReadableForeColorAsString(string backgroundColor)
{
// turn the background color into Color obj
var c = ColorTranslator.FromHtml($"#{backgroundColor}");
@samdenty
samdenty / README.MD
Last active November 11, 2021 04:57
VS Code CSS addition to increase readability on file tree.

How to install

Custom CSS plugin

Install the custom CSS plugin, then make a file on your computer that will hold your custom CSS, I like to make one in my home directory called ~/.vscodestyles.css and then add the CSS into it.

Once done, open your command palette and select enable custom CSS and JS

@mwpastore
mwpastore / 00README.md
Last active April 18, 2024 06:21
Lightning Fast WordPress: Caddy+Varnish+PHP-FPM

README

This gist assumes you are migrating an existing site for www.example.com — ideally WordPress — to a new server — ideally Ubuntu Server 16.04 LTS — and wish to enable HTTP/2 (backwards compatibile with HTTP/1.1) with always-on HTTPS, caching, compression, and more. Although these instructions are geared towards WordPress, they should be trivially extensible to other PHP frameworks, other FastCGI backends, and even non-FastCGI backends (using proxy in lieu of fastcgi in the terminal Caddyfile stanza).

Quickstart: Use your own naked and canonical domain names instead of example.com and www.example.com and customize the Caddyfile and VCL provided in this gist to your preferences!

These instructions target Varnish Cache 4.1, PHP-FPM 7.0, and Caddy 0.10. (I'm using MariaDB 10.1 as well, but that's not relevant to this guide.)

@adamdehaven
adamdehaven / bgimage.css
Last active March 7, 2024 17:38
Bootstrap full-width hero section with text and image
.bgimage {
width:100%;
height:500px;
background: url('https://images.unsplash.com/photo-1438109491414-7198515b166b?q=80&fm=jpg&s=cbdabf7a79c087a0b060670a6d79726c');
background-repeat: no-repeat;
background-position: center;
background-size:cover;
background-attachment: fixed;
}
.bgimage h5 {
@pdbartsch
pdbartsch / OpenRefine Nominatim Geocode
Last active January 14, 2024 12:43
open-refine geocoding using OpenStreetMap's Nominatim service. (previously called google-refine)
Step One - Starting with a single address field
Edit Column > Add Column by Fetching URLs
Nominatim has a limit of 1 geocode per second so make sure to set the throttle delay to greater than 1000 milliseconds
Fetch URL based on column (quotes needed):
"http://nominatim.openstreetmap.org/search?format=json&email=[YOUR_EMAIL_HERE].com&app=google-refine&q=' + escape(value, 'url')"
------------------------------------------------------------------------------------
Step Two - Extract lat/lon from newly created JSON blobs
@thenbrent
thenbrent / subscription-sync.php
Last active August 26, 2021 08:22
Example code to sync a subscription to a specific date. All the good parts are thanks to @peterwilsoncc, all the bad parts are my own. This is not intended to be a complete and working snippet. Instead, treat it as a guide to what needs to be changed for syncing a payment date.
<?php
/**
* Plugin Name: WooCommerce Subscriptions Date Sync
* Plugin URI:
* Description: Sets the start date of a subscription to September 13, 2013
* Author: Peter Wilson
* Author URI: http://peterwilson.cc/
* Version: 1.0.0
*/
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
@parezcoydigo
parezcoydigo / newtask.py
Created August 10, 2012 00:13
Add task to The Hit List from the Terminal
#! usr/bin/env python
# -*- encoding: utf8 -*-
# Requires Python 2.7, or 2.6 with argparse installed.
# Currently adds task to The Hit List only to the inbox.
import argparse, os
@jfro
jfro / update-dns.sh
Created January 11, 2012 17:31
Linode dynamic DNS updating script
#!/bin/sh
# modified by jfro from http://www.cnysupport.com/index.php/linode-dynamic-dns-ddns-update-script
# Uses curl to be compatible with machines that don't have wget by default
LINODE_API_KEY=licensekey
DOMAIN_ID=domainid
RESOURCE_ID=resourceid
WAN_IP=`curl -s http://example.com/whatsmyip.php`
if [ -f $HOME/.wan_ip.txt ]; then
@rolo
rolo / gist:1481128
Created December 15, 2011 13:44
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update