Skip to content

Instantly share code, notes, and snippets.

Avatar
🔍
Looking for new opportunities.

Byron komplexb

🔍
Looking for new opportunities.
View GitHub Profile
View FULL CONVERSION JS TAG SALES TYPE EXAMPLE.html
<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
svg icon as background
View svgIconBg.scss
&[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 Nov 10, 2016
2. functional js: hiding state in a closure via https://youtu.be/kA4-b7hvWhg
View after.js
// 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 / after.js
Last active Nov 10, 2016
1. functional js: extracting common protocols via https://youtu.be/kA4-b7hvWhg
View after.js
// 1. extract what is common
function executeWithConnection(functionToExecute, argument) {
try {
var db = connectToDataBase(credentials());
functionToExecute(db, asSqlInsert(track));
}
catch(e) {
handleDatabaseError(e);
}
}
View work-item.html
<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>
View get_page_in_section.rb
def get_page_in_section access_token
encoded_access_token = URI::escape(access_token)
params = {:params => {:select => 'title,contentUrl,links'}}
headers = {:content_type => "application/json", :Authorization => "Bearer #{encoded_access_token}", :params => {:select => 'title,contentUrl,links'}}
# debugger
response = RestClient.get PAGES_URL, headers
JSON.parse(response)
end
@komplexb
komplexb / dynamicListNavigation.js
Last active Aug 29, 2015
dynamic list navigation: used to toggle forward/backward; next/back on lists, galleries and similar constructs
View dynamicListNavigation.js
function moveCarouselItems (isDirectionForward) {
var currentImage = parentObject.find('.current_image'),
carouselItems = parentObject.find('ul li'),
position = carouselItems.index(currentImage);
if (isDirectionForward === null || isDirectionForward === undefined )
isDirectionForward = true;
if(isDirectionForward) {
if(position < carouselItems.length - 1) {
View cardinalPoints
var pointsObj = { N:0, E:90, S:180, W:270 };
var _getDegree = function (orientation) {
switch (orientation) {
case "N":
return 0;
case "E":
return 90;
case "S":
return 180;
@komplexb
komplexb / regex_href.txt
Last active Aug 29, 2015
regex: find and replace href tag
View regex_href.txt
Seach String: href\=\".*\"\s
@komplexb
komplexb / svg-bg.html
Created Sep 9, 2014
faking svg as a background: when you embed svg as CSS background, you can't style the elements inside it with external css, this method attempts to do so alternatively
View svg-bg.html
<div class="content">
<div class="background-image">
<!-- SVG MARKUP -->
</div>
</div>