Skip to content

Instantly share code, notes, and snippets.

View nathanbirrell's full-sized avatar

Nathan Birrell nathanbirrell

View GitHub Profile
@anastaciocintra
anastaciocintra / Compare two data objects .md
Last active June 26, 2024 20:25
Compare two objects JS

Compare two data objects / arrays in javascript and/or typescript regardless of the order of the data;

When to use:

  • When you need compare two "json" objects to know if it have same data.
  • When the order of the array doesn't matters ie. [1,2] should be equal [2,1], but it is configurable.
  • lightweight - just one small .js file

when not to use:

  • when you need to compare more complex objects, with functions, for example.
@weliveindetail
weliveindetail / rename_exif.py
Created November 25, 2021 12:26
Python3 script to rename files based on EXIF info
#!/usr/local/bin/python3
import os
from PIL import Image
from hachoir.parser import createParser
from hachoir.metadata import extractMetadata
# Parameters
dir = '/path/to/media/files'
image_extensions = ['.jpg']
video_extensions = ['.mp4']
@max10rogerio
max10rogerio / slugify.ts
Last active May 25, 2024 15:58
Typescript slug function
// MIT License
// Copyright (c) 2023 Max Rogério
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@moeinalmasi
moeinalmasi / fb_unlike_all.js
Last active October 3, 2022 08:22
Unlike All Facebook Pages
// Run it at your own risk!!
// If you have been on Facebook since 2004 and happened to like ton of pages and wanna get rid of them all at once...
// Navigate to https://www.facebook.com/pages/?category=liked and run the the following snippet in the developer console...
var fb_unlike_all = () => {
[].slice
.call(document.querySelectorAll("button"))
.filter((x) => x.innerText.indexOf("Liked") != -1)
.map((x) => {
x.click();
});
@bodokaiser
bodokaiser / context.ts
Last active August 10, 2023 01:00
React Hook integration for AWS Amplify Auth
import React from "react"
import { CognitoUser } from "@aws-amplify/auth"
import { useAuth } from "./hooks"
import { SignInInput } from "./types"
interface AuthState {
user: CognitoUser | null
signIn(input : SignInInput): Promise<void>
signOut(): Promise<void>
@jmadden91
jmadden91 / LaPavoni.ino
Last active March 25, 2020 05:56
La Pavoni Heater Control
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <EEPROM.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
int a = 1;
int b = 1;

'Users hate change'

This week NN Group released a video by Jakob Nielsen in which he attempts to help designers deal with the problem of customers being resistant to their new site/product redesign. The argument goes thusly:

  1. Humans naturally resist change
  2. Your change is for the better
  3. Customers should just get used to it and stop complaining

There's slightly more to it than that, he caveats his argument with requiring you to have of course followed their best practices on product design, and allows for a period of customers being able to elect to continue to use the old site, although he says this is obviously only a temporary solution as you don't want to support both.

@dongri
dongri / uninstall-netskope.sh
Last active February 16, 2024 15:23
uninstall netskope
#!/bin/sh
sudo ps aux | grep Netskope | grep -v grep | awk '{ print "kill -9", $2 }' | sudo sh
echo '[✓] Kill Netskope Process'
sudo rm -rf /Applications/Remove\ Netskope\ Client.app
echo '[✓] Removed Remove Netskope Client.app'
sudo rm -rf /Library/Application\ Support/Netskope
echo '[✓] Removed Agent of Netskope Client.app'
@jaydenseric
jaydenseric / DeferredQuery.jsx
Created July 2, 2019 03:34
A <DeferredQuery> react component that loads a react-apollo <Query> on demand.
import React from 'react'
import { Query } from 'react-apollo'
export const DeferredQuery = ({ children, ...props }) => {
const [skip, setSkip] = React.useState(true)
const load = () => setSkip(false)
return (
<Query skip={skip} {...props}>
{args => children({ ...args, load })}
</Query>
/* Helper buddy for removing async/await try/catch litter 🗑 */
function O_o(promise) {
return promise.then(data => {
if (data instanceof Error) return [data]
return [null, data]
}).catch(err => [err])
}
/* Look ma, no try/catch */
async function usageExample(params) {