Skip to content

Instantly share code, notes, and snippets.

View gokhantaskan's full-sized avatar
🎯
Focusing

Gökhan Taşkan gokhantaskan

🎯
Focusing
View GitHub Profile
@gokhantaskan
gokhantaskan / conversion.ts
Last active March 17, 2023 20:12
CO₂ mass unit conversion
// ! Co2 always in tons
export function convertCO2Units(co2t: number): string {
const units = ["g", "kg", "t"];
let co2g = co2t * 1_000_000; // convert to grams
let unitIndex = 0;
while (co2g > 1000 && unitIndex < units.length - 1) {
co2g /= 1000;
unitIndex++;
}
@gokhantaskan
gokhantaskan / table.vue
Last active December 25, 2020 19:35
ElementUI Table with Collapse Option (Accordion Style)
<template>
<el-table
ref="table"
row-key="someKey"
@row-click="rowClick"
@expand-change="expandChange"
:data="data"
>
<el-table-column type="expand">
<template v-slot:default="{ row }">
@gokhantaskan
gokhantaskan / i18n.js
Created April 10, 2020 09:22
Vue i18n.js file for "xx-YY.json" types
import Vue from "vue";
import VueI18n from "vue-i18n";
Vue.use(VueI18n);
function loadLocaleMessages () {
const locales = require.context("./locales", true, /[a-z]{2}-[A-Z]{2}.json$/i);
const messages = {};
locales.keys().forEach(key => {
const matched = key.match(/[a-z]{2}-[A-Z]{2}/i);
<div class="sixteen-nine">
<div class="content">
insert content here
this will maintain a 16:9 aspect ratio
</div>
</div>
@gokhantaskan
gokhantaskan / material-colors.scss
Created March 30, 2019 16:09
MaterializeCSS colors and classes with single variables
$materialize-red: (
"base": #e51c23,
"lighten-5": #fdeaeb,
"lighten-4": #f8c1c3,
"lighten-3": #f3989b,
"lighten-2": #ee6e73,
"lighten-1": #ea454b,
"darken-1": #d0181e,
"darken-2": #b9151b,