Skip to content

Instantly share code, notes, and snippets.

Tim Knight timknight

Block or report user

Report or block timknight

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timknight
timknight / install-craft.sh
Created Jul 16, 2017
Installation Script for Craft CMS 2.x Setups
View install-craft.sh
if [[ $# -eq 0 ]]; then
project=${PWD##*/}
elif [[ $# -eq 1 ]]; then
project=$1
mkdir $project && cd $project
else
echo "Usage:"
echo -e '\tType "craft [project]" to create a project with a specific name'
echo -e '\tType "craft" within a blank project folder to take that folder as the project name'
exit 1
@timknight
timknight / SassMeister-input.scss
Last active May 16, 2016
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
$bem: (
namespace: "-",
modifier: "--",
descendent: "__"
);
@timknight
timknight / README.markdown
Last active Aug 29, 2015
Improved BEM Mixins
View README.markdown

I've previously used a mixin format for creating BEM-based selectors that would allow me to do something like this:

.block {
  @include e(element) {
    @include m(modifier) {...}
  }
}
@timknight
timknight / breakpoint-v2.scss
Last active Apr 23, 2018
Revised Breakpoint Mixin
View breakpoint-v2.scss
$xs: ( max: 767px );
$sm: ( min: 768px );
$md: ( min: 992px );
$lg: ( min: 1200px );
$sm-only: ( min: map-get($sm, min), max: map-get($md, min) - 1 );
$md-only: ( min: map-get($md, min), max: map-get($lg, min) - 1 );
@mixin breakpoint($map) {
$query: "";
@if map-has-key($map, min) { $query: append($query, "(min-width: #{map-get($map, min)})") }
@timknight
timknight / SassMeister-input.scss
Last active Aug 29, 2015
Convert percentages to decimal function
View SassMeister-input.scss
// ----
// Sass (v3.4.1)
// Compass (v1.0.1)
// ----
@function decimal($percentage) {
$decimal: $percentage / 100; // Returns the number as a decimal
$decimal: $decimal / ($decimal * 0 + 1); // Removes the % unit off the number
@return $decimal;
}
@timknight
timknight / breakpoint.scss
Created May 5, 2014
A simple responsive breakpoint mixin that takes both attribute names and custom widths. See https://medium.com/p/889927b37740/
View breakpoint.scss
@mixin breakpoint($min: 0, $max: 0) {
$type: type-of($min);
@if $type == string {
@if $min == xs {
@media (max-width: 767px) { @content; } // Mobile Devices
}
@else if $min == sm {
@media (min-width: 768px) { @content; } // Tablet Devices
View parallax.js
window.onscroll = function() {
var speed = 4.0;
var ypos = -window.pageYOffset / speed + "px";
var xpos = "50%";
var elems = document.getElementsByClassName('parallax');
for (var i = elems.length - 1; i >= 0; i--) {
elems[i].style.backgroundPosition = xpos +" "+ ypos;
};
}
View gist:51122
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
You can’t perform that action at this time.