Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Coding or gaming

Luke Shiru lukeshiru

:shipit:
Coding or gaming
View GitHub Profile
@lukeshiru
lukeshiru / logo.svg
Created May 27, 2023 04:25
My manually written avatar and logo SVGs
View logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukeshiru
lukeshiru / spongeBobCase.ts
Last active March 9, 2021 03:17
Sponge Bob casing util
View spongeBobCase.ts
/** Takes a string and returns it's upper case */
export const upperCase = (source: string) => source.toLocaleUpperCase();
/** Takes a string and returns it's lower case */
export const lowerCase = (source: string) => source.toLocaleLowerCase();
/** Takes a `from` and a `to` and returns a random integer. */
export const randomNumber = (from: number) => (to: number) =>
Math.round(Math.random() * Math.abs(to - from)) + Math.min(from, to);
@lukeshiru
lukeshiru / cssPath.js
Created March 12, 2020 06:57
Get CSS path of given element.
View cssPath.js
/**
* @param {Element} element
* @param {string} path
*/
var cssPath = (element, path = "") =>
((tag, nth) =>
tag
? cssPath(
element.parentElement,
`${
@lukeshiru
lukeshiru / design-mode.js
Created September 28, 2019 15:14
Design Mode Toggle Bookmarklet
View design-mode.js
javascript:((d,o,m)=>{d[m]=d[m]!==o?o:"off"})(document,"on","designMode")
@lukeshiru
lukeshiru / programmers-day.js
Created September 13, 2019 16:09
Log only on programmer's day
View programmers-day.js
/**
* Get current day number.
* @param now Target date (current date by default).
*/
const dayNumber = (now = new Date()) =>
(start => Math.floor((now.getTime() - start.getTime()) / 864e5))(
new Date(now.getFullYear(), 0, 0)
);
if (dayNumber() === 256) {
@lukeshiru
lukeshiru / npm.1-1.svg
Last active October 19, 2019 16:09
NPM Logo
View npm.1-1.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukeshiru
lukeshiru / responsibilities.md
Last active March 3, 2018 02:05
Back end and front end responsibilities (best practices)
View responsibilities.md

Back end and front end responsibilities

Each environment (back and front ends) should be agnostics from each other. This means that the back end should not assume any front end, and should be able to be consumed by other clients, and also means that there should be not mixes between the both.

Responsability Back end Front end Explanation
Routing X Back end should red
@lukeshiru
lukeshiru / npm-logo.svg
Last active March 3, 2018 02:03
NPM logo optimized (196 bytes)
View npm-logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.