Skip to content

Instantly share code, notes, and snippets.

View yosevu's full-sized avatar

Yosevu Kilonzo yosevu

View GitHub Profile
@yosevu
yosevu / transformStyle.js
Created June 14, 2019 15:33
Transform Style
const getSelectedOptions = facet => {
const options = get(
facet,
'searchFacetOptionGroupList.searchFacetOptionList'
);
const isActiveAndSelected = option =>
option.isActive === 'true' && option.isSelected === 'true';
return filter(options, isActiveAndSelected);
};
@yosevu
yosevu / transform-style.js
Last active June 13, 2019 12:53
transformStyle
// transformStyle :: Object -> Object
const transformStyle = facet => {
result.facetSelected.style = [];
facetOptions.style = facet;
facetOptions.style.searchFacetName = 'Category';
facetOptions.style.facetType = 'multi-select';
facetOptions.style.facetLayout = 'list';
@yosevu
yosevu / checkbox.scss
Last active June 12, 2019 20:09
left-facet checkbox styles #gap
.checkbox {
@extend .sds_checkbox-a;
&__input {
@extend .sds_checkbox-a__input;
}
&__box {
@extend .sds_checkbox-a__box;
}
@yosevu
yosevu / sudoku-validator.js
Created February 27, 2019 13:59
sudoku-validator
function getIndex(i) {
return Math.floor(i / 3);
}
function fillArray(len, item) {
return new Array(len).fill(item);
}
function isValid(totals) {
const result = Object.values(totals).every(total => {
@yosevu
yosevu / export-git-log.txt
Created December 1, 2018 19:00
Export git log
git --no-pager log > log.txt
@yosevu
yosevu / entities.html
Last active December 1, 2018 18:14
Entities
<head>
<meta charset="utf-8">
<title>GitHub Pull Requests for Everyone</title>
<meta name="description" content="Writing good pull requests makes everyones life easier. Catherine shares how to set up successful code reviews with good pull requests.">
<meta property="og:title" content="GitHub Pull Requests for Everyone" />
<meta property="og:description" content="Writing good pull requests makes everyone&amp;apos;s everyone&#039;s life easier. Catherine shares how to set up successful code reviews with good pull requests." />
</head>
#
# Main prompt
#
# local host_name="%{$fg[cyan]%}λ"
local path_string="%{$fg[white]%}%1~"
local prompt_string="λ"
# Make prompt_string red if the previous command failed.
@yosevu
yosevu / bufferToBase64.js
Created July 1, 2018 03:27
Buffer to base64
const b = Buffer.from('hello, world');
console.log(b);
// <Buffer 68 65 6c 6c 6f 2c 20 77 6f 72 6c 64>
const s = b.toString('base64');
console.log(s);
// aGVsbG8sIHdvcmxk
console.log(b.toString());
// hello, world
@yosevu
yosevu / change-screenshot-folder.md
Created June 26, 2018 18:52
change screenshot folder (macOS)

defaults write com.apple.screencapture location /Users/sparkuser/Pictures/Screenshots

@yosevu
yosevu / uploadImage.js
Last active June 18, 2018 19:04
Sails.js uploadImage helper
module.exports = {
friendlyName: 'Upload image',
description: 'Upload an image to AWS S3.',
inputs: {
req: {
type: 'ref',
example: 'req',
description: 'request object',