Skip to content

Instantly share code, notes, and snippets.

View SaadBazaz's full-sized avatar
🦾
Breaking stuff

Saad A. Bazaz SaadBazaz

🦾
Breaking stuff
View GitHub Profile
@albertpak
albertpak / _document.js
Created April 28, 2021 18:04
Add FB Chat messenger to NextJS
// In case anyone else needs this, here's what I done to add FB Messenger code to my NextJS app - As mentioned before, you need to drop the plugin code into `_document.js` and modify `script` tag
import Document, { Html, Head, Main, NextScript } from 'next/document';
export default class MyDocument extends Document {
render() {
return (
<Html>
<Head>
{/* code that you want to add to the header */}
@jivanpal
jivanpal / kill-adobe-daemons.sh
Last active August 6, 2023 17:23
Stop Adobe Creative Cloud daemons (background processes) in their tracks
#!/bin/bash
if [ "$1" = "-s" ] || [ "$1" = "--show" ]; then
show=true
else
show=false
fi
if $show || [ "$1" = "-v" ] || [ "$1" = "--verbose" ]; then
verbose=true
@ayyybe
ayyybe / ccdl.command
Last active May 2, 2024 16:08
Adobe Offline Package Builder v0.1.2 (macOS only) --- No longer being maintained.
#!/bin/bash
CYAN="$(tput bold; tput setaf 6)"
RESET="$(tput sgr0)"
clear
if command -v python3 > /dev/null 2>&1; then
if [ $(python3 -c "print('ye')") = "ye" ]; then
clear
@fabe
fabe / dotgrid.js
Last active January 18, 2023 10:21
Creates an svg dot grid in React
import React from 'react';
export default ({
width = 10,
height = 10,
space = 10,
radius = 1.5,
fill = '#000',
}) => {
const viewWidth = width * radius * 2 + (width - 1) * (space - radius * 2);
@parties
parties / renameReactJsToJsx.sh
Last active May 19, 2024 05:57
rename all *.js files containing React markup to *.jsx
# finds all *.js files that have either `</` or `/>` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "</|/>" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
@JesseRWeigel
JesseRWeigel / commands.txt
Created April 28, 2017 19:22
ImageMagick Compression Commands
// Must install ImageMagick first
http://www.imagemagick.org/script/index.php
//This compresses a jpg with no visible loss of quality. Add in your own file names for target.jpg and result.jpg
convert -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% target.jpg result.jpg
// This does the same as above but to an entire folder (will overwrite original files):
mogrify -strip -interlace Plane -sampling-factor 4:2:0 -quality 85% *.jpg
//This does the same thing but to all subfolders as well (Be careful with this one it will overwrite all original files)
@mcandre
mcandre / apple-bluetooth-keyboard-windows-10-bootcamp.md
Created June 14, 2016 18:12
How to fix Apple Bluetooth Wireless Keyboard (Windows 10)

The driver situation with Apple Bluetooth wireless keyboards and Windows 10 is horrible, even with the latest BootCamp drivers. Fortunately, a workaround is available, if you're patient.

Pair keyboard once

  1. Turn on the keyboard.
  2. Press and hold Command + w until the keyboard light begins blinking, indicating the keyboard is ready to pair.
  3. Use Windows Bluetooth settings to pair the keyboard, entering the same code (e.g. 123456 Enter) on both internal and external keyboards.

Pairing the keyboard is very trial and error. 9/10 times, Windows will complain that the keyboard is not available for pairing. Just keep trying.

@theodox
theodox / PhotoshopSockets.js
Last active December 15, 2020 21:05
A simple server that can be run inside photoshop, demonstrating how to respond to socket calls
// requires photoshop CS5+
// create a new socket
conn = new Socket();
var keep_serving = true;
// sample functions. In a real application you'd have handler functions that could accept more complex inputs
var alrt = alert; // pop a dialog
var newLayer = function () { return app.activeDocument.artLayers.add(); }; // make a layer
var stop = function () { keep_serving = false; }; // stop the server
@TomByrne
TomByrne / MultiExporter.jsx
Last active May 5, 2024 21:54
An Illustrator script for exporting layers and/or artboards into separate files (PNG8 / PNG24 / EPS / PDF / SVG / JPG / FXG).See http://www.tbyrne.org/export-illustrator-layers-to-svg-files
// MultiExporter.jsx
// Version 0.1
// Version 0.2 Adds PNG and EPS exports
// Version 0.3 Adds support for exporting at different resolutions
// Version 0.4 Adds support for SVG, changed EPS behaviour to minimise output filesize
// Version 0.5 Fixed cropping issues
// Version 0.6 Added inner padding mode to prevent circular bounds clipping
//
// Copyright 2013 Tom Byrne
// Comments or suggestions to tom@tbyrne.org