Skip to content

Instantly share code, notes, and snippets.

"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"comment",
"comment.block",
"comment.block.documentation",
"comment.line",
"constant",
"constant.character",
@viswanathsaj
viswanathsaj / LatestPost.js
Last active May 21, 2024 17:40
Implementation for a load more button in React/NextJS using Ghost CMS
// Make sure you are pulling ALL your posts from the ghost API [No limit]
function LatestPost (props) {
const [ postNum, setPostNum] = useState(3); // Default number of posts dislplayed
function handleClick() {
setPostNum(prevPostNum => prevPostNum + 3) // 3 is the number of posts you want to load per click
}
@joakin
joakin / git-find-me-the-fucking-deleted-file.sh
Last active May 21, 2024 17:37
finding a deleted file in a git repository
# If you don't remember the exact path/name, search the log for deleted files
git log --diff-filter=D --summary | grep delete
# Find the file you want to get from the ouput, and use the path
# Find the commits that involved that path
git log --all -- some/path/to/deleted.file
# Bring the file back to life to the current repo (sha commit of parent of commit that deleted)
git checkout shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file
@donpandix
donpandix / valida_rut.js
Last active May 21, 2024 17:34
Valida RUT chileno con JavaScript
var Fn = {
// Valida el rut con su cadena completa "XXXXXXXX-X"
validaRut : function (rutCompleto) {
if (!/^[0-9]+[-|‐]{1}[0-9kK]{1}$/.test( rutCompleto ))
return false;
var tmp = rutCompleto.split('-');
var digv = tmp[1];
var rut = tmp[0];
if ( digv == 'K' ) digv = 'k' ;
return (Fn.dv(rut) == digv );
@Ravarcheon
Ravarcheon / spectralRotation.py
Last active May 21, 2024 17:33
rotates an audio file by 90 degrees in the spectrum while being a reversible process with minimal loss (only floating point errors which are like -150 dB but thats literally silence ahaha~)
import numpy as np
import soundfile as sf
from scipy.fftpack import fft, ifft
def rotateSignal(signal,flip):
if flip:
signal = signal[::-1]
x = np.concatenate((signal, signal[1:][::-1])) # concatenating the array with a reverse of itself makes it such that the fourier transform doesn't layer over a reversed version of itself in the inverse fft
rotSig = ifft(x)
Roblox.Hack = {
original: 'missingno',
balance: 0,
initialized: 0,
loading: false,
items: [],
inventoryString: '<li class="list-item item-card ng-scope"><div class="item-card-container"><a class="item-card-link" href="%1" data-ytta-id="-"><div class="item-card-thumb-container"><div ng-hide="item.Product.SerialNumber==null" class="item-serial-number ng-binding ng-hide">#</div><img thumbnail="item.Thumbnail" image-retry="" class="item-card-thumb ng-isolate-scope" src="%2"></div><div class="text-overflow item-card-name ng-binding" title="%6 ">%6 </div></a><!-- ngIf: item.Item.AudioUrl --><div class="text-overflow item-card-creator"><span class="xsmall text-label">By</span> <a class="xsmall text-overflow text-link ng-binding" ng-href="%3" ng-hide="assetsListContent.assetItems.data.Data.PageType!==\'favorites\'&amp;&amp;currentData.category.name==\'Places\'&amp;&amp;(currentData.subcategory.name==\'My VIP Servers\'||currentData.subcategory.name==\'Other VIP Servers\')&amp;&amp;staticData.isOwnPage" href="%3"
@olivia3215
olivia3215 / instructions.md
Last active May 21, 2024 17:32
Instructions for importing a Dreamhost mail drop into gmail

Using a Dreamhost mailbox from gmail

To those with mailboxes on Dreamhost, such as on our domain cindysworld.org, these instructions will be helpful in using your mailbox from gmail. If you are hosted on another domain, just replace cindysworld.org with your domain in the following instructions.

Changing your password

Every email user can log into https://mailboxes.dreamhost.com/ with their full email and current password. Once logged in, they can reset the password. If the user does not remember the current password, they must contact the account manager.

@wojteklu
wojteklu / clean_code.md
Last active May 21, 2024 17:31
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@rphlmr
rphlmr / helpers.ts
Last active May 21, 2024 17:30
Drizzle ORM, deep sub queries
/* -------------------------------------------------------------------------- */
/* More here; */
/* -------------------------------------------------------------------------- */
//gist.github.com/rphlmr/0d1722a794ed5a16da0fdf6652902b15
https: export function distinctOn<Column extends AnyColumn>(column: Column) {
return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`;
}
export function jsonBuildObject<T extends SelectedFields>(shape: T) {