Skip to content

Instantly share code, notes, and snippets.

View bergantine's full-sized avatar

J*Bergantine bergantine

  • London, United Kingdom
View GitHub Profile
@bergantine
bergantine / gist:8233006
Created January 3, 2014 04:59
Fix iPhone (iOS) Safari viewport scaling bug when rotating between landscape and portrait (from http://webdesignerwall.com/tutorials/iphone-safari-viewport-scaling-bug)
<script type="text/javascript">
(function(doc) {
var addEvent = 'addEventListener',
type = 'gesturestart',
qsa = 'querySelectorAll',
scales = [1, 1],
meta = qsa in doc ? doc[qsa]('meta[name=viewport]') : [];
function fix() {
@bergantine
bergantine / gist:8142407
Last active April 14, 2018 20:44
Fluid-width (responsive) Vimeo and YouTube videos. Adapted from CSS Tricks. http://css-tricks.com/NetMag/FluidWidthVideo/Article-FluidWidthVideo.php
// Find all YouTube videos
var $allVideos = $("iframe[src^='//player.vimeo.com'], iframe[src^='http://www.youtube.com']");
// The element that is fluid width
var $fluidEl = $("body");
// Figure out and save aspect ratio for each video
$allVideos.each(function() {
$(this)
@bergantine
bergantine / prompt.sh
Last active December 27, 2015 17:39 — forked from roychri/prompt.sh
# Configure colors, if available.
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
c_reset='\[\e[0m\]'
c_user='\[\e[0;32m\]'
c_path='\[\e[1;34m\]'
c_git_clean='\[\e[0;37m\]'
c_git_staged='\[\e[0;32m\]'
c_git_unstaged='\[\e[0;31m\]'
else
c_reset=
<div class="container">
<ul>
<li id="pink">Pink</li>
<li id="salmon">Salmon</li>
<li id="blue">Blue</li>
<li id="green">Green</li>
<li id="red">Red</li>
</ul>
</div>
@bergantine
bergantine / gist:5521525
Last active December 17, 2015 00:29
Vagrantfile for Flask-Newproj #vagrant #flask #python #vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.define :djangovm do |cfg|
# Every Vagrant virtual environment requires a box to build off of.
# The precise64_vagrant122 box is built for vagrant 1.2.2
cfg.vm.box = "precise64_vagrant122"
# The url from where the 'config.vm.box' box will be fetched if it
@bergantine
bergantine / gist:5302604
Last active December 15, 2015 18:19
Vagrantfile for PHP-Newproj #vagrant #php #apache #vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.define :lampvm do |cfg|
# Every Vagrant virtual environment requires a box to build off of.
cfg.vm.box = "precise64"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
@bergantine
bergantine / gist:5243223
Last active September 27, 2018 03:04
CSS grayscale filter (go from grayscale to full color on hover) #css #sethneilson
img:hover {
-webkit-filter: grayscale(0%);
-webkit-transition: .5s ease-in-out;
-moz-filter: grayscale(0%);
-moz-transition: .5s ease-in-out;
-o-filter: grayscale(0%);
-o-transition: .5s ease-in-out;
}
img {
@bergantine
bergantine / gist:4742424
Last active December 12, 2015 08:09 — forked from murtaugh/1. single-line.html
Blockquote semantics enhanced by figure. #html #html5 #figure #happycog
Single line, no attribution:
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
</figure>
Single line, with attribution and optional cite:
<figure class="quote">
<blockquote>It is the unofficial force—the Baker Street irregulars.</blockquote>
@bergantine
bergantine / gist:4487752
Last active September 6, 2020 22:39 — forked from dhc02/gist:4487729
Concatenate files in a directory into a single file. #ruby #donnieclapp
# Iterates over files and subdirectories in directorie[s] given as arguments
# and adds raw text of those files to merged.txt in the working directory
# where the script is called
# Call like this:
# ruby merge.rb {absolute path portion to delete} {directory to scan} [{directory to scan}]
# For example:
# ruby merge.rb /Users/donnieclapp/Projects/ ~/Projects/htl-website/myproject/static_media/stylesheets
# create or open the merged.txt file for writing (in working directory)
@bergantine
bergantine / gist:4340665
Last active December 9, 2015 22:58
Remove iOS button styling on an input (SASS + Compass). #html #html5 #safari #safarimobile #ios #button #input #form
input[type="submit"]
+experimental(appearance, none) // safari mobile does funny things