Skip to content

Instantly share code, notes, and snippets.

View burnoutprojects's full-sized avatar
Convert Caffeine Into Code

Antonis Triantafyllopoulos burnoutprojects

Convert Caffeine Into Code
View GitHub Profile
@burnoutprojects
burnoutprojects / year_percent.js
Last active October 4, 2023 11:14
Percentage of the year with ascii bar
const curYear = new Date().getFullYear()
const start = new Date(curYear, 0, 1);
const end = new Date(curYear, 11, 31);
const today = new Date();
const percent = Math.floor(((today - start) / (end - start)) * 100);
let bar = '';
for (i = 0.5; i <= 10; i += 0.5) {
if ((percent / (i * 10)) >= 1.0) {
@burnoutprojects
burnoutprojects / Types vs Interfaces.md
Last active August 21, 2023 10:49
Typescript Types vs Interfaces
Type Interface
In typescript type is defined for a variable’s data type which means type declaration in typescript is used for declaring names of different types such as user-defined, built-in, or any other data types. Interfaces are defined as the syntax for the class which provides a way to define entities.
It uses the type keyword for defining new types. It uses the interface keyword for declaring an interface.
Types can be used for others like built-in types, tuples, etc. The interface cannot be used with other types of declaration.
Types cannot be extended and hence it does not support classes. Interfaces can be extended and it supports classes.
In Typescript, union types can contain one or more types. In typescript this feature of union types is not supported as we cannot create a union interface by combining two types.

Source

@burnoutprojects
burnoutprojects / ipv_4_6_regex_check.txt
Last active October 29, 2022 03:28
IPv4 and IPv6 regex
# IPv4 and IPv6 regex test
# source: https://ihateregex.io/
# IPv4
/(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/gm
# IPv6
/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/gm
### Keybase proof
I hereby claim:
* I am burnoutprojects on github.
* I am kamenos96 (https://keybase.io/kamenos96) on keybase.
* I have a public key ASAw1eKWxt-kA1dQcivXVcMPth0cx8N7IyskbEXpgFp2kAo
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am kamenos96 on github.
  • I am kamenos96 (https://keybase.io/kamenos96) on keybase.
  • I have a public key ASB5pmuiEGzWl3AjQr9H71NTtVpZGXSi2DdeNG6mlZE7ZQo

To claim this, I am signing this object:

@burnoutprojects
burnoutprojects / README.md
Last active October 19, 2020 22:54 — forked from cferdinandi/README.md
A vanilla JS fork of Lettering.js
@burnoutprojects
burnoutprojects / main.js
Created October 19, 2018 02:02
Config for Vue with Tailwind.css and PurgeCss
import Vue from "vue";
import App from "./App.vue";
import "@/assets/tailwind.css";
Vue.config.productionTip = false;
new Vue({
render: h => h(App)
}).$mount("#app");
@burnoutprojects
burnoutprojects / bootstrap.messagebox.js
Created November 22, 2017 03:41 — forked from afshinm/bootstrap.messagebox.js
Twitter Bootstrap Message Box Plugin
(function ($) {
/* Twitter Bootstrap Message Helper
** Usage: Just select an element with `alert` class and then pass this object for options.
** Example: $("#messagebox").message({text: "Hello world!", type: "error"});
** Author: Afshin Mehrabani <afshin.meh@gmail.com>
** Date: Monday, 08 October 2012
*/
$.fn.message = function(options) {
//remove all previous bootstrap alert box classes
this[0].className = this[0].className.replace(/alert-(success|error|warning|info)/g , '');