Skip to content

Instantly share code, notes, and snippets.

View saki007ster's full-sized avatar
:octocat:

Saket Kumar saki007ster

:octocat:
View GitHub Profile
@saki007ster
saki007ster / comp.html.twig
Created January 23, 2021 05:54
Patternlab Technical Tips
{% set comp = node.field_competition.entity %}
{% set data = {
location: node.field_location.value,
has_audio: node.field_has_audio.value,
comment: node.field_comment.value,
score_opponent: node.field_score_opponent.value,
highlights: node.field_match_highlights.value,
competition: comp.field_name.value,
competition_logo: comp.field_logo.entity.getFileUri() | image_style('small'),
name: gatsby
proxy:
appserver:
# Though Gatsby will be running on 80, it will still be available via SSH here.
- gatsby.lndo.site
services:
# Prefer appserver as a name since Lando defaults to it - making `lando ssh` functional as opposed to a required service name (`lando ssh nodejs`
appserver:
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var elements = document.body.getElementsByTagName('*');
var items = [];
var links = document.querySelectorAll("a");
var linkReport = [];
var linksChecked=0;
links.forEach(function(link){
var reportLine = {url: link.getAttribute('href'), status:0, redirectedTo: "", message : "", element : link};
linkReport.push(reportLine);
console.log("HEAD " + reportLine.url);
@saki007ster
saki007ster /  helper.js
Created December 29, 2017 11:09
helper function for web assembly fetch and instantiate
function fetchAndInstantiateWasm (url, imports) {
return fetch(url)
.then(res => {
if (res.ok)
return res.arrayBuffer();
throw new Error('Unable to fetch Web Assembly file ${url}.');
})
.then(bytes => WebAssembly.compile(bytes))
.then(module => WebAssembly.instantiate(module, imports || {}))
.then(instance => instance.exports);
@saki007ster
saki007ster / debounce.js
Created August 22, 2017 09:00
debounce
// Create JD Object
// ----------------
/*
It's a good idea to attach helper methods like `debounce` to your own
custom object. That way, you don't pollute the global space by
attaching methods to the `window` object and potentially run in to
conflicts.
*/
var JD = {};
#!/bin/bash
#Background Colors
E=$(tput sgr0); R=$(tput setab 1); G=$(tput setab 2); Y=$(tput setab 3);
B=$(tput setab 4); M=$(tput setab 5); C=$(tput setab 6); W=$(tput setab 7);
function e() { echo -e "$E"; }
function x() { echo -n "$E "; }
function r() { echo -n "$R "; }
function g() { echo -n "$G "; }
function y() { echo -n "$Y "; }
function b() { echo -n "$B "; }
@saki007ster
saki007ster / rem.scss
Created June 7, 2017 05:24
Rem Fallback
@function strip-unit($num) {
@return $num / ($num * 0 + 1);
}
@mixin rem-fallback($property, $values...) {
$max: length($values);
$pxValues: '';
$remValues: '';
@for $i from 1 through $max {
@saki007ster
saki007ster / pr.md
Created May 10, 2017 15:42 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@saki007ster
saki007ster / lifecycle-element.html
Last active May 13, 2016 21:05
polymer element lifecycle
<dom-module id="lifecycle-element">
<template>
<style>
:host {
display: block;
}
</style>
<button id="btn">Hello world</button>
</template>
<script>