Skip to content

Instantly share code, notes, and snippets.

View jonnymaceachern's full-sized avatar

Jonny jonnymaceachern

  • Developer @ Media Mechanics
  • Halifax, NS
  • 12:10 (UTC -03:00)
View GitHub Profile
assoc .ext="Some Extension Name"
ftype "Some Extension Name"="c:/sublime_text.exe"
javascript:function removeSubscriptions() { var subs = $('.subscription-box .remove.active'); subs.each( function(i, v) { setTimeout( function() { $(this).trigger('click'); console.log('Unsubscribing... (' + (i+1) + '/' + (subs.length + 1) +')'); }.bind(this), i * 500); }); } removeSubscriptions();
/**
* Trim beginning and end of group
*/
@mixin trim-padding {
&:first-of-type {
padding-left: 0;
}
&:last-of-type {
padding-right: 0;
/**
* Get color based of $colors map
*/
@function color($color) {
@return map-get($colors, $color );
}
// Usage
.header {
PC::debug( compact('atts', 'item', 'args') );

Keybase proof

I hereby claim:

  • I am jonnymaceachern on github.
  • I am jonnymaceachern (https://keybase.io/jonnymaceachern) on keybase.
  • I have a public key whose fingerprint is 092E 2E5F 5D35 1E0B A64B 8E62 EF04 4D24 1316 0AC0

To claim this, I am signing this object:

@jonnymaceachern
jonnymaceachern / _fonts.scss
Last active July 14, 2017 18:38
Mixin to declare font face for all file types (.eot, .woff, .ttf, .svg)
@mixin declare-font-face($font-family, $font-filename, $font-weight : normal, $font-style :normal, $font-stretch : normal) {
@font-face {
font-family: '#{$font-family}';
src: url(font-path('#{$font-filename}.eot'));
src: url(font-path('#{$font-filename}.eot?#iefix')) format('embedded-opentype'),
url(font-path('#{$font-filename}.woff')) format('woff'),
url(font-path('#{$font-filename}.ttf')) format('truetype'),
url(font-path('#{$font-filename}.svg##{$font-family}')) format('svg');
font-weight: $font-weight;
font-style: $font-style;
@jonnymaceachern
jonnymaceachern / css-logo-carousel.css
Last active July 14, 2017 18:38
Infinite scrolling image via CSS
@jonnymaceachern
jonnymaceachern / git-ignore-by-directory.sh
Last active July 14, 2017 18:40
Basically a .gitignore file for your local environment. Allows you to ignore files without updating the .gitignore directives.
exclude = !sh -c 'echo "$1" >> .git/info/exclude' -
@jonnymaceachern
jonnymaceachern / index.php
Last active July 17, 2017 16:50
Get YouTube ID by URL
<?php
function get_youtube_id( $url ) {
preg_match( "#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $matches );
return $matches[0];
}
// Test
echo get_youtube_id( "https://youtu.be/MZj1bQtRNdk" ) );