Skip to content

Instantly share code, notes, and snippets.

View celmaun's full-sized avatar
🏠
Working from home

Celmaun celmaun

🏠
Working from home
View GitHub Profile
@celmaun
celmaun / frontend-interview-questions.md
Created January 24, 2026 01:03
frontend-interview-questions.md

Frontend Interview Questions

HTML

Based on the principles of modern web standards, which of the following best describes "Semantic HTML" and its primary importance?

A. It acts as a server-side directive that compiles HTML into binary code for faster execution. B. It refers to using specific HTML markup that reflects the type and meaning of the content (e.g., <article><footer>), which is crucial for accessibility and SEO context. C. It is a deprecated method of styling that uses attributes like font-color directly within tags to ensure older browsers can read the text. D. It is a strict validation rule that prevents the page from rendering if tags are not closed properly.

@celmaun
celmaun / docker-etc-hosts-install.sh
Last active December 10, 2024 12:02
Installs docker container names and IP addresses in /etc/hosts https://x.com/Celmaun/status/1866434295805456807
#!/usr/bin/env bash
# vim:set ft=bash ts=4 sw=4 et :
# shellcheck shell=bash
# shellcheck disable=SC2317
## Usage:
## docker-etc-hosts-install
## Installs docker container names and IP addresses in /etc/hosts
## This script is idempotent
## Note: Requires root privileges to write to /etc/hosts
@celmaun
celmaun / deferred_promise.js
Created April 25, 2021 09:59 — forked from oliverfoster/deferred_promise.js
Deferred promise
class DeferredPromise extends Promise {
constructor(def = (res, rej)=>{}) {
let res, rej;
super((resolve, reject)=>{
def(resolve, reject);
res = resolve;
rej = reject;
});
this.resolve = res;
@celmaun
celmaun / generate-client.sh
Created April 23, 2021 01:29 — forked from Belphemur/generate-client.sh
Generate a new client configuration for WireGuard
#!/usr/bin/env bash
if [ -z "$1" ]
then
echo "$0 client-name"
exit 1
fi
@celmaun
celmaun / unit.sh
Created February 18, 2021 22:16 — forked from tvlooy/unit.sh
Bash test: get the directory of a script
#!/bin/bash
function test {
MESSAGE=$1
RECEIVED=$2
EXPECTED=$3
if [ "$RECEIVED" = "$EXPECTED" ]; then
echo -e "\033[32m✔︎ Tested $MESSAGE"
else
@celmaun
celmaun / README.md
Created November 17, 2012 15:42 — forked from mbostock/.block
Line Chart
<b>Sallu Rocks!</b>
@celmaun
celmaun / code.php
Created November 25, 2011 15:04
Grab youtube video download URLs
preg_match("/yt\.setConfig\(\{\s+\'PLAYER_CONFIG\'\:\s(?<config>.*?)\s+\}\)/s", $page, $matches);
$config = json_decode($matches['config']);
$fmts = explode(',', $config->args->url_encoded_fmt_stream_map);
foreach( $fmts as $k => $v ) { parse_str($v, $fmts[$k]); }
@celmaun
celmaun / code.php
Created November 25, 2011 15:03
Get youtube video download URLs
preg_match("/yt\.setConfig\(\{\s+\'PLAYER_CONFIG\'\:\s(?<config>.*?)\s+\}\)/s", $page, $matches);
$config = json_decode($matches['config']);
$fmts = explode(',', $config->args->url_encoded_fmt_stream_map);
foreach( $fmts as $k => $v ) { parse_str($v, $fmts[$k]); }
<?php
// Quick bug fix for Issue #24837 (http://www.magentocommerce.com/bug-tracking/issue/?issue=10453)
$rootBlock = Mage::app()->getLayout()->getBlock('root');
if ( false !== $rootBlock ) {
foreach ( Mage::getModel('page/config')->getPageLayouts() as $pageLayout ) {