Skip to content

Instantly share code, notes, and snippets.

View Camwyn's full-sized avatar
🐫
yup

Stephen Page Camwyn

🐫
yup
View GitHub Profile
@Camwyn
Camwyn / centering.scss
Created November 2, 2016 14:57
Centering via position and transform
// Position an element horizontally (requires a 'position: relative' parent)
@mixin horizontal-center {
position: absolute;
left: 50%;
transform: translateX(-50%);
}
// Position an element vertically (requires a 'position: relative' parent)
@mixin vertical-center {
@Camwyn
Camwyn / svg-icons.scss
Created November 2, 2016 14:55
Mixin for creating svg icons
/**
* Icon
* Allows easy insertion of an svg icon.
*
* $icon-name: name of the icon used in the symbol-defs (needs quotes)
* $fill: icon fill color
* $property: background-image or content?
* example: @include icon('cross', '#000', content);
*/
@mixin icon($icon-name, $fill: false, $property: background-image) {
@Camwyn
Camwyn / visual-focus.scss
Created November 2, 2016 14:23
Visual focus mixins
// Add styles on active/focus/hover
@mixin visual-focus {
&:active,
&:focus,
&:hover {
@content;
}
}
// Remove outline on active/focus/hover
@Camwyn
Camwyn / README.md
Last active October 13, 2016 15:08
Steps to archive a git branch

##ARCHIVING A BRANCH:

  • git checkout <branch name>
  • git tag archive/<branch name> (yes, this would be "archive/fix/hot_sauce")
  • git push origin <branch name> (pushes the tag(s) to the server)
  • git checkout master (could be any branch other than the one you'r archiving, most repos have a "master")
  • git branch -D <branch name> (delete the branch locally)
  • git push origin —delete <branch name> (push the delete - delete the branch on the server)

##To re-use the branch:

@Camwyn
Camwyn / fade.js
Last active October 27, 2015 20:18
Proportionate fade on scroll
( function ( $, document ) {
var fadeItem = function () {
$('.fader').first().each( function() {
var $this = $(this),
$container = $this.parents( '.container' ),
height_percentage = $container.height() / $( document ).height(),
container_offset = $container.offset(),
scroll_percent = $(window).scrollTop() / ($(document).height() - $(window).height() + container_offset.top);
if ( $this.hasClass( 'is_stuck' )) {
@Camwyn
Camwyn / SassMeister-input-HTML.html
Created October 15, 2015 07:41
Generated by SassMeister.com.
<div class="test">TEST</div>
#!/bin/sh
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@Camwyn
Camwyn / .gitconfig
Last active September 10, 2024 18:24
My aliases for git
[alias]
# list aliases
aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'
# list branches
br = branch
# show current branch - tried to use to get branch name for other aliases
bn = !git rev-parse --abbrev-ref HEAD
@Camwyn
Camwyn / OMGGITSVNBBQ.md
Last active May 27, 2022 13:35
PUSH to VIP

#GIT/SVN to VIP (OMG GITSVN BBQ!)

Created and maintained to ease pushing a git repo to VIP (svn)

Notes: <branch name> is the name of your feature/fix/whatever branch so if you’re merging a branch named fix/hot-sauce then substitute “fix/hot-sauce" wherever you see <branch name>

###MERGE:

  • git checkout master
  • git pull
  • git merge --no-ff <branch name>

###SVN PUSH:

@Camwyn
Camwyn / social_Icon_function.php
Last active August 29, 2015 14:17
Function to build social icon list for wordpress
<?php
/**
* Output social icons for a post.
* Assumes you have filters for building share URLs named build_twitter_url & etc.
* @param integer $post_id: the id of the post
* @param string $classes: a space-separated list of classes to add to the section
* @param boolean $circled: use circled icons
* @return string HTML section containing the list of icon links
*/
public function social_icons( $post_id = NULL, $classes = '', $circled = FALSE )