Skip to content

Instantly share code, notes, and snippets.

View Nixinova's full-sized avatar

Nixinova

View GitHub Profile
@aras-p
aras-p / preprocessor_fun.h
Last active May 23, 2024 08:26
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@rxaviers
rxaviers / gist:7360908
Last active May 24, 2024 03:53
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 23, 2024 15:25
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@Cadiboo
Cadiboo / Conventions.md
Last active July 2, 2023 14:23
Conventions (WIP)

What, Why, Consequences of not doing it, How to do it right

Required Java conventions

What: Lowercase package naming.
Why: Some file systems (windows) consider iTeMs and items to be the same, but every other system considers them to be different.
Consequences: Not doing this may never cause any issues (and very likely won't in your dev environment), but on other operating systems with different case-sensitivities from yours this can cause massive problems.
How: Name your packages all in lowercase.

What: Packaging that reflects your web presence.
Why: Avoid name collisions - your web presence is unique so it is commonly used.
Consequences: Errors loading classes with other mods installed, usually happens when 2 mods never changed their packaging from the default in the MDK.

@Nixinova
Nixinova / language_id.rb
Last active July 13, 2021 08:20
Linguist language ID generator
#!/usr/bin/env ruby
require 'digest'
language = 'InsertLangHere' # replace with full lang name
id = Digest::SHA256.hexdigest(language).to_i(16) % (2**30 - 1)
puts id
@sindresorhus
sindresorhus / esm-package.md
Last active May 24, 2024 02:36
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@williambl
williambl / AAAAAA.zip
Last active May 15, 2024 22:10
some shader packs for 21w10a
@broofa
broofa / checkForUndefinedCSSClasses.js
Last active January 21, 2024 17:22
ES module for detecting undefined CSS classes (uses mutation observer to monitor DOM changes). `console.warn()`s undefined classes.
/**
* Sets up a DOM MutationObserver that watches for elements using undefined CSS
* class names. Performance should be pretty good, but it's probably best to
* avoid using this in production.
*
* Usage:
*
* import cssCheck from './checkForUndefinedCSSClasses.js'
*
* // Call before DOM renders (e.g. in <HEAD> or prior to React.render())
@Nixinova
Nixinova / obfus.js
Last active May 10, 2022 09:50
JavaScript obfuscation
function encode(string) {
const isolate = v => `[${v}][+[]]`;
const ZERO = isolate(`+[]`);
const ONE = isolate(`+!![]`);
const count = n => ('+' + ONE).repeat(n);
const toString = str => isolate(`${str}+[]`);
const FALSE = toString(toString(`!!${ZERO}`));
const TRUE = toString(toString(`!${ZERO}`));
const NAN = toString(isolate(`+[![]]`));
const UNDEFINED = toString(isolate(``));
@Nixinova
Nixinova / bookmarklet.js
Last active September 21, 2021 06:48
GitHub Lightshow syntax highlighting improver bookmarklet. Makes testing and previewing tmLanguage files much easier
javascript:(()=>{
/*
save this as a bookmark
run on https://github-lightshow.herokuapp.com
*/
document.head.innerHTML += `<style>
.code{background-color:#fff;color:#333;font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;font-size:12px}
[class*="pl-"] {color: white !important;}