Skip to content

Instantly share code, notes, and snippets.

<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 -->
@razwan
razwan / typography.scss
Created December 2, 2015 13:14
Typography Prototype
@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 */
}
@razwan
razwan / _wp-offset.scss
Last active September 14, 2016 12:03
WordPress admin-bar offsets
// 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
@razwan
razwan / _baseline.scss
Created April 14, 2014 16:20
Aligning type to baseline the right way with SASS
$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) {
@razwan
razwan / kmp.js
Last active August 5, 2020 23:07
Implementation of the KMP pattern-matching alghoritm in JavaScript
// 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];
}