This file contains 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
When you load css bundle asyncronously this can happen: | |
>> FYI- bundling assets is a separate issue from CSS core features | |
1) it load: | |
.class-3 { color: green; } | |
<div class="class-3"> | |
2) it load | |
.class-1 { color: red; } | |
.class-2 { color: blue; } |
This file contains 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
:root { | |
--translate-item: calc(50% - 20px); | |
} | |
.x-translate { | |
box-sizing: content-box; | |
padding: 8px; | |
width: 24px; | |
height: 24px; | |
background-color: rgba(0,0,0, .8); |
This file contains 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
{ | |
"foo": "Hello Template", | |
"repeatCount": 5 | |
} |
This file contains 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 prefix($property, $value, $prefixes: ()) { | |
@each $prefix in $prefixes { | |
#{"--" + $prefix + "-" + $property}: #{$value}; | |
} | |
#{$property}: $value; | |
} | |
@mixin flexbox { | |
display: -webkit-box; | |
display: -moz-box; |
This file contains 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
<polymer-element name="x-picture" attributes="src srcset title alt currentSrc media"> | |
<template> | |
<style> | |
x-picture { | |
text-align: center; | |
object-fit: contain; | |
object-position: center; | |
} |
This file contains 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
def quicksort a | |
(pivot = a.pop) ? quicksort(a.select{|i| i <= pivot}) + [pivot] + quicksort(a.select{|i| i > pivot}) : [] | |
end |
This file contains 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
def find_in(arr, obj) | |
return -1 if !arr.include?(obj) | |
arr.find_index obj | |
end |
This file contains 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
#taken from Floyds Algorithm (http://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare) | |
def floyd(f, x0) | |
tortoise = f(x0) | |
hare = f(f(x0)) | |
while tortoise != hare | |
tortoise = f(tortoise) | |
hare = f(f(hare)) | |
end | |
mu = 0 |
This file contains 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
def is_perfect_square?(x) | |
return false if x < 1 | |
sqrt = Math::sqrt(x) | |
x == sqrt.floor**2 | |
end |
This file contains 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
def char_count(paragraph) | |
paragraph.split(%r{\s*}).count | |
end | |
def each_word_counts(paragraph) | |
details = {} | |
paragraph.split(/\s/).each { |word| details[word] = word.length } | |
details | |
end |
NewerOlder