Skip to content

Instantly share code, notes, and snippets.

View komplexb's full-sized avatar

Byron komplexb

View GitHub Profile
<span id="a8sales"></span>
<script src="//statics.a8.net/a8sales/a8sales.js"></script>
<script> a8sales({
"pid": "s00000000001001", "order_number": "order1234", "currency": "USD",
"items": [
{
"code": "A001", "price": 23.35, "quantity": 1
},
], "total_price": 23.35 });
</script>
@komplexb
komplexb / svgIconBg.scss
Created May 18, 2017 15:00
svg icon as background
&[target="_blank"] {
display: flex;
align-items: center;
&::after {
content: '';
background-image: url("data:image/svg+xml,%3Csvg fill='%23cacacb' id='icon-out' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 17'%3E%3Cpolygon points='13 9 13 15 2 15 2 4 8 4 8 2 0 2 0 17 15 17 15 9 13 9'/%3E%3Cpolygon points='15 0 10 0 10 2 13.59 2 6.76 8.83 8.17 10.24 15 3.41 15 7 17 7 17 2 17 0 15 0'/%3E%3C/svg%3E ");
background-size: contain;
background-repeat: no-repeat;
margin-left: 7.5px;
@komplexb
komplexb / after.js
Last active November 10, 2016 17:18
1. functional js: extracting common protocols via https://youtu.be/kA4-b7hvWhg
// 1. extract what is common
function executeWithConnection(functionToExecute, argument) {
try {
var db = connectToDataBase(credentials());
functionToExecute(db, asSqlInsert(track));
}
catch(e) {
handleDatabaseError(e);
}
}
@komplexb
komplexb / after.js
Last active November 10, 2016 17:18
2. functional js: hiding state in a closure via https://youtu.be/kA4-b7hvWhg
// run: https://repl.it/EU15/3
function writeComment(count, author, text) {
if(count > 3) {
throw new Error(author + 'executed too many actions!!');
}
console.log(author, text); // saveComment(author, text);
return count + 1;
}
@komplexb
komplexb / ellipsis
Created November 1, 2013 15:19
Adding an ellipsis
.classname {
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.color-box {
float: left;
margin-right: 2px;
}
.color-box {
border: 1px solid #E1E2E5;
display: inline-block;
height: 15px;
margin-right: 5px;
@komplexb
komplexb / pairValue.css
Last active December 16, 2015 19:08
a data list for label:value pairs
dl.pairValue {
display: block;
margin: 0;
vertical-align: top;
}
/* optional if you add clearfix to the dl
dl.pairValue:after {
clear: both;
content: ".";
@komplexb
komplexb / wrapper.css
Last active December 16, 2015 10:49
checkboxes, radiobuttons wrapper
.checkbox-wrapper, .radiobutton-wrapper {
cursor: pointer;
display: block;
padding-left: 15px;
text-indent: -15px;
}
.checkbox > input[type="checkbox"], .radiobutton-wrapper > input[type="radio"] {
height: 13px;
margin: 0;
@komplexb
komplexb / toggleSection
Last active December 16, 2015 07:09
a bit like an accordion, except it doesn't collapse the other sections when you open one
//default style
.js-collapsibleHeader {
cursor: pointer;
}
//style when closed
.collapsibleHeader.closedContent {
}
<div class="thumb-wrap">
<div class="thumb-container">
{% for project_hash in site.data.work.projects %}
{% assign project = project_hash[1] %}
<a aria-label="{{ project.engagement-type }}: {{ project.name }}; Tenure: {{ project.tenure | replace: '-','to' }}"
class="thumb-unit-wrap" href="/work/{{project.folder}}/page">
<div class="thumb-unit">
<img src="assets/img/work/{{project.folder}}/thumb.{{project.thumb}}" alt="" />
<span class="" aria-hidden=true>{{ project.tenure }}</span>
</div>