Skip to content

Instantly share code, notes, and snippets.

View webinista's full-sized avatar

Tiffany Brown webinista

View GitHub Profile
@webinista
webinista / index.html
Created August 9, 2015 05:18
Using input[type=range] to create toggles
<h1>Using <code>input[type=range]</code> to create toggles</h1>
<p>
<input type="range" value="0" min="0" max="1" step="1">
</p>
@webinista
webinista / flexbox-mixin.scss
Last active February 23, 2017 13:57
A Sass mixin for using Flexbox
// See current support chart http://caniuse.com/#search=flexbox
/*
Flexbox mixins
Public Domain.
Latest syntax only.
*/
@mixin display-flex {
display: -webkit-flex;
@webinista
webinista / multiple-columns.scss
Last active August 29, 2015 14:24
Mixins for working with Multiple Column Layout
// See current support chart http://caniuse.com/#feat=multicolumn
/*
Column mixins by Tiffany Brown (@webinista / webinista.com)
Public domain licensed, because, really who couldn't come up with this on their own?
It's not required, but I'd appreciate you letting me know if you found these useful :-).
*/
@mixin column-count($value) {
-moz-column-count: $value;
@webinista
webinista / bdYXrO.markdown
Last active August 29, 2015 14:23
Animating SVG elements
@webinista
webinista / RunAProxyOnAmazonEC2VPC.md
Last active April 27, 2024 12:21
Create a proxy server on an Amazon EC2 (VPC) instance

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
  • Select Create a new security group.
@webinista
webinista / ChunkAlphabetically.php
Last active August 8, 2022 13:56
Split an array into chunks based on the first letter of one of its column values.
<?php
global $alpha_chunks;
# Initialize array
$alpha_chunks = array();
function chunkNames(&$value, $key, $letter) {
global $alpha_chunks;
@webinista
webinista / matchMediaAddEventListener.js
Created March 24, 2015 17:33
Use addEventListener/removeEventListener instead of
/*
CSSOM View[1] initially defined addListener() and removeListener() methods for the
MediaQueryList interface (the object type returned by matchMedia()). Later, the
spec changed and now MediaQueryList uses addEventListener/removeEventListener
and MediaQueryList is really a change event in disguise.
Chrome and Opera have made this change. Other browsers are still working on it.
This code snippet makes it possible to use addEventListener/removeEventListener
in (almost) every browser (the usual caveats about browser support apply).
@webinista
webinista / gist:3adbd4ce1b95566d5d13
Created March 10, 2015 16:21
Rewrite base dir and all URLs to subdir
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/$ /content/ [L]
RewriteRule ^(.*)$ /content/$1 [L]
</IfModule>
# END WordPress
@webinista
webinista / genpass.php
Created December 18, 2014 19:30
Command-line PHP script for generating random-ish passwords.
<?php
/*
* Designed to be used on the command line.
* php genpass.php [arg1] [arg2] ...
* Accepts up to three parameters:
* --length or -l = length of the password
* --specialchars or -s = whether to include punctuation in generating the password
* --unique or -u = whether to prevent repeated characters in a string
*
*/
@webinista
webinista / radio-buttons.css
Created December 16, 2014 05:44
Custom radio buttons
input[type=radio].fancy-rb {
color: #c09 !important;
border: 1px solid #0c0 !important;
}
input[type=radio].fancy-rb {
opacity: 0;
}
input[type=radio].fancy-rb + label::before,
input[type=radio].fancy-rb + label::after {