get every digit of a num

vector<int> digits;
while (n){
	digits.push_back(n % 10);
	n /= 10;
}

benchmark count execute time

void benchmark(const string &name, const auto &func) {
  auto start = chrono::high_resolution_clock::now();
  func();
  auto end = chrono::high_resolution_clock::now();
  auto duration = chrono::duration_cast<chrono::milliseconds>(end - start);
  cout << format("{} execution time: {} ms\n", name, duration.count());
}

toBase

string toBase(int x, int base){
	string res;
	while (x){
		int mod = x % base;
		res += (mod < 10 ? mod + '0' : mod - 10 + 'A');
		x /= base;
	}
	reverse(res.begin(), res.end());
	return res;
}

jiangly

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;

using u128 = unsigned __int128;
using i128 = __int128;

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	
	return 0;
}

How to Master the Gravity-Defying Tunnels: A Guide to Experiencing Run 3

Hey everyone! If you are looking for a fun way to pass the time during a quick study break or a lazy weekend afternoon, browser-based games are usually the perfect go-to. Among the endless sea of platformers out there, one title always brings back a wave of fond nostalgia and pure, unadulterated fun: Run 3. It is a deceptively simple, space-themed game that tests your reflexes and somehow always keeps you hitting that "restart" button for just one more try. Today, I want to share a quick overvie

First col auto width with truncation, second col fixed

.container {
  display: grid;
  grid-template-columns: minmax(0, max-content) 200px;
  gap: 16px;
}

.first-col {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

NOS

**Some quick templates/snippets when coding and solving Problems**
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;

#ifndef DEBUG
struct __X {
  __X& operator<<(const auto& str) { return *this; }
  void sp(const string& str = "") {}
} dout;
#define debug(x)
#endif

int main(){
	cin.tie(0)->sync_with_stdio(0);

	return 0;
}

hello

#include <iostream>

int main(){
  cout << "hello world" << endl;
  return 0;
}

Log php errors - wp-congif

Add in wp-config Add those to log in wp debug.log too define('WP_DEBUG', true); define('WP_DEBUG_DISPLAY', false); define('WP_DEBUG_LOG', true);
@ini_set('log_errors', '1');
@ini_set('error_log', __DIR__ . '/php-errors.log');

convertir_mov_a_mp4

# convierte archivos de video mov a mp4

ffmpeg -i {in-video}.mov -vcodec h264 -acodec aac {out-video}.mp4

1022. Sum of Root To Leaf Binary Numbers

You are given the root of a binary tree where each node has a value 0 or 1. Each root-to-leaf path represents a binary number starting with the most significant bit. For example, if the path is 0 -> 1 -> 1 -> 0 -> 1, then this could represent 01101 in binary, which is 13. For all leaves in the tree, consider the numbers represented by the path from the root to that leaf. Return the sum of these numbers. The test cases are generated so that the answer fits in a 32-bits integer.
/**
 * Definition for a binary tree node.
 * function TreeNode(val, left, right) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.left = (left===undefined ? null : left)
 *     this.right = (right===undefined ? null : right)
 * }
 */
/**
 * @param {TreeNode} root
 * @return {number}
 */
var sumRootToLeaf = function(root) {
    // DFS helper: carries the current binary value down the tree
    function dfs(node, currentValue) {
        if (!node) {
            // Null nodes contribute n

Cycle Viewport BG

Toggles the viewport bg colour setting
import hou

def cycle_viewport_bg():
    """
    Toggles the viewport bg between "Dark" and "Light"
    Works best as a shelf button with a hotkey such as CTRL+ALT+B bound to it
    
    TO DO:
    - Make this work with all open scene viewers (currently only change one when split views are used)
    - Have alternate funcions to cycle through other bg settings such as "Dark Grey"
    """
    
    # Get scene viewer pane and current bg setting
    pane = hou.ui.paneTabOfType(hou.paneT

Detach Parameter Window

Opens a floating parameter pane that is pinned to the currently selected node.
import hou

def detach_parm_window():
    """Open a floating parameter pane for the selected node."""
    node = hou.selectedNodes()[0]
    pane_tab = hou.ui.curDesktop().createFloatingPaneTab(hou.paneTabType.Parm)
    pane_tab.setCurrentNode(node)
    pane_tab.setPin(True)
    return pane_tab

DVT Example

public class InputChecks {
    
    public boolean checkAlphaSpace(String s) {
        return s.matches("[a-zA-Z ]+") == true;
    }

    public boolean containsNumbers(String s) {
        boolean hasNumbers = false;

        for (char ch : s.toCharArray()) {
            if (Character.isDigit(ch)) {
                hasNumbers = true;
            }
        }
        return hasNumbers;
    }

    public boolean containsSymbols(String s) {
        boolean hasSymbols = false;

  

Variants - TW3 / TW4



// TW 3
@layer components {
  .x {
    color: red;
    border: 1px solid red;
  }
}


// TW 4 
@utility x {
  color: red;
  border: 1px solid red;
}



<div class="[&_ul]:x">
  <ul>
    <li>Test</li>
  </ul>
</div>

ページパスをハードコードではなく定義ファイルで管理する例

export const ROUTES = {
  // トップページ
  HOME: '/',

  // 静的ページ
  ABOUT: '/about',
  CONTACT: '/contact',
  PRIVACY_POLICY: '/privacy-policy',

  // ニュース(一覧 + 動的詳細ページ)
  NEWS: {
    INDEX: '/news',
    DETAIL: (id: string) => `/news/${id}` as const,
    CATEGORY: (category: string) => `/news/category/${category}` as const,
  },

  // ブログ(一覧 + 動的詳細ページ)
  BLOG: {
    INDEX: '/blog',
    DETAIL: (slug: string) => `/blog/${slug}` as const,
  },

  // 認証
  AUTH: {
    LOGIN: '/login',
    REGISTER: '/re