Skip to content

Instantly share code, notes, and snippets.

@develar
develar / commit-message-format.md
Created September 1, 2017 05:34
Commit Message Format

Commit Message Format

Each commit message consists of a header, a body and a footer. The header has a special format that includes a type, a scope and a subject:

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
@fatbobman
fatbobman / dynamicHeightSheet.swift
Created April 5, 2024 06:59
a dynamic sheet demo
import SwiftUI
struct ContentView: View {
@State var show = false
@State var height: CGFloat = 250
var body: some View {
List {
Button("Pop Sheet") {
height = 250
show.toggle()
@probonopd
probonopd / Send infrared commands from the Arduino to the iRobot Roomba
Created March 17, 2013 10:42
Send infrared commands from the Arduino to the iRobot Roomba. Use a transistor to drive the IR LED from pin D3 for maximal range.
#include <IRremote.h>
/*
Send infrared commands from the Arduino to the iRobot Roomba
by probono
2013-03-17 Initial release
@mjbalcueva
mjbalcueva / password-input.tsx
Last active May 5, 2024 14:13
shadcn ui custom password input
"use client"
import { forwardRef, useState } from "react"
import { EyeIcon, EyeOffIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import { Input, InputProps } from "@/components/ui/input"
import { cn } from "@/lib/utils"
const PasswordInput = forwardRef<HTMLInputElement, InputProps>(
({ className, ...props }, ref) => {
import os, sys, zlib, traceback
from Crypto.Cipher import AES
from struct import unpack as up
XORPAD = '3F99BB49B43CBBD339FE5FEA463316A8'.decode('hex')
KEY = 'CAECB4CA65678965CBE67D7A3AFD228C'.decode('hex')
IV = 'A65D5EA2D54AD0436DD46158C191361D'.decode('hex')
def safe_open(path, mode):
import os

Rustの演算子の優先順位 Operator precedence

  • 次の表で、演算子を優先順位降順に並べる。
    • 単項演算子は二項演算子より優先されることが分かる。
      • より正確には、後置単項演算子 > 前置単項演算子 > 二項演算子 の順。
    • 「非結合」演算子では、その結合を丸括弧 (,) で明示しないと文法エラーとなる。
      • a == b == c - Error
      • (a == b) == c - OK
  • フィールド演算子.?より強い。よって &self.hoge?&((self.hoge)?)となる。
@OrionReed
OrionReed / dom3d.js
Last active May 5, 2024 14:09
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@NazimCodes
NazimCodes / SnakeGame.cpp
Last active May 5, 2024 14:06
Snake Game made out of C++
/* Snake Game using C++
developed by TheKittyKat,
improved by Nazim Nazari
December 2017 */
#include <iostream>
#include <conio.h>
using namespace std;
void run();
@thiamsantos
thiamsantos / db-conventions.md
Last active May 5, 2024 14:03
Convenções de nomenclatura para banco de dados

Convenções de nomenclatura para banco de dados

Geral

Os nomes das tabelas e colunas devem estar minúsculas e as palavras devem ser separadas por underscore, seguindo o padrão snake case. E todos os termos devem estar em inglês, exceto alguns termos que não há tradução apropriada para o inglês. Sempre prefira nomes descritivos, evitando ao máximo contrações.

Tabelas

Os nomes das tabelas devem estar no plural.

@primaryobjects
primaryobjects / hotspot-keep-alive.ps1
Last active May 5, 2024 14:03
Script to Enable Windows 10 Mobile Hotspot Automatically After Reboot
# https://superuser.com/a/1434648
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result