This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// processing time O(m) | |
// added space O(m) | |
// time complexity: O(n+m) | |
function errorTable (p, m, f) { | |
for (var j = 1; j <= m-1; j++) { | |
k = f[j-1]; | |
while (k!=-1 && p[j-1] != p[k]) { | |
k = f[k]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$base-font-size: 16px; | |
$base-line-height: 1.5; | |
// this value may vary for each font | |
// unitless value relative to 1em | |
$cap-height: 0.68; | |
@mixin baseline($font-size, $scale: 2) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// WP Offset Mixin | |
// | |
// this is a mixin used to increase the value of a specific property with | |
// the height of the .admin-bar added by WordPress | |
// | |
// @params | |
// $property - the property that depends on the .admin-bar height | |
// $value - initial value of the property above [px] | |
// $fixed - tells if the element is set to fixed and it should become static when the .admin-bar does | |
// $sign - there mey be times when you want to substract the .admin-bar height instead of adding it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin font-face($name, $filename, $weight: regular) { | |
@font-face { | |
font-family: $name; | |
font-wight: $weight; | |
src: url(unquote($filename) + '.eot'); /* IE9 Compat Modes */ | |
src: url(unquote($filename) + '.woff2') format('woff2'), /* Super Modern Browsers */ | |
url(unquote($filename) + '.woff') format('woff'), /* Pretty Modern Browsers */ | |
url(unquote($filename) + '.ttf') format('truetype'), /* Safari, Android, iOS */ | |
url(unquote($filename) + '.svg#svgFontName') format('svg'); /* Legacy iOS */ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="c-card"> | |
<div class="c-card__header"> | |
<h2 class="c-card__title">Title text here</h3> | |
</div> | |
<div class="c-card__body"> | |
<p>I would like to buy:</p> | |
<!-- A layout module --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the semi-colon before the function invocation is a safety | |
// net against concatenated scripts and/or other plugins | |
// that are not closed properly. | |
;(function ($, window, document, undefined) { | |
function PluginName(element, options) { | |
this.element = element; | |
// jQuery has an extend method that merges the | |
// contents of two or more objects, storing the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the semi-colon before the function invocation is a safety | |
// net against concatenated scripts and/or other plugins | |
// that are not closed properly. | |
;(function ($, window, document, undefined) { | |
var windowHeight = $(window).height(), | |
lastKnownScrollY; | |
$(window).on('resize', function(e) { | |
windowHeight = $(window).height(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;var Module = (function(undefined) { | |
var privateVariable = ''; | |
function privateMethod() { | |
console.log('did this'); | |
} | |
function exposedMethod() { | |
privateMethod(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$baseline-unit: 12px !default; | |
$baseline-debug: false !default; | |
@mixin baseline($baseline-font-size: 16px, $baseline-line-height: 1.25, $cap-height-ratio: 0.68, $margin-bottom: 3rem) { | |
$baseline-distance: ($baseline-line-height - $cap-height-ratio) / 2; | |
// set the proper font-size and line-height to size the element in multiples of baseline units | |
font-size: ($baseline-font-size / $baseline-unit) * 1rem; | |
line-height: $baseline-line-height; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$breakpoints: ( | |
xsmall: 30em, // ~ 480px | |
small: 42.5em, // ~ 680px | |
pad: 50em, // ~ 800px | |
lap: 62.5em, // ~ 1000px | |
desk: 80em // ~ 1280px | |
) !default; | |
@mixin above($bpname) { | |
$breakpoint: map-get($breakpoints, $bpname); |
OlderNewer