Skip to content

Instantly share code, notes, and snippets.

View ssaadh's full-sized avatar
🎯
Focusing

Saadh ssaadh

🎯
Focusing
View GitHub Profile
@ssaadh
ssaadh / javascript-nested-ternary-vs-switch-case.js
Last active July 5, 2019 20:52
Javascript nested ternary vs switch case. Which is better?
# Easier to copy paste from what I was doing. Working on a React Component.
# Was working with React and d3. So the functions are imported from d3.
import { axisTop, axisRight, axisBottom, axisLeft } from 'd3-axis';
# Ternary example as a small function
ternaryEx = ( bootstrap ) => bootstrap === 'top' ? axisTop :
bootstrap === 'right' ? axisRight :
bootstrap === 'bottom' ? axisBottom :
axisLeft;

Keybase proof

I hereby claim:

  • I am inoicouldalwaysturn2u on github.
  • I am chase_ats (https://keybase.io/chase_ats) on keybase.
  • I have a public key ASDnT4Kj1NyrLglQz8Un2DUb84JO8U_MJ8Pxbp3Qv5oB0go

To claim this, I am signing this object:

@ssaadh
ssaadh / shop-css-overwrite.css
Created March 19, 2018 19:51
shopify css overwriting
.shopify-buy__layout-horizontal:not(.no-image) .shopify-buy__product-img-wrapper {
float: none !important;
width: 100% !important;
}
.shopify-buy__product-img-wrapper {
float: none !important;
width: 100% !important;
}
@ssaadh
ssaadh / Shazam all songs to youtube and spotify.js
Last active September 3, 2017 23:24 — forked from seungjulee/Shazam all songs to youtube and spotify.js
Shazam Crawler and Youtube Searcher in the console
// change this variable to change timeout for async scroll load
var TIMEOUT_IN_MS = 1000
// script from https://gist.github.com/xavhan/87717da0217b9b8299df
// start from www.shazam.com/myshazam
// print all shazam songs loaded on the page
// TODO: Change format to JSON
function printShazamSongs(){
$(".details").each(function(i){
var artist = $(this).find(".artist meta").attr("content");
@ssaadh
ssaadh / launchd-script-to-keep-macos-app-running-at-all-times.plist
Last active May 3, 2017 03:25
Launchd script to keep a macOS app to always run even if it closes randomly (issue I'm having from crashes). Place in ~/Library/LaunchAgents and run <code>launchctl load ~/Library/LaunchAgents/FILENAME.plist</code>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>App.restart</string>
@ssaadh
ssaadh / macos-spotlight-rebuilding-sierra-2017.sh
Last active May 3, 2017 03:35
Spotlight Rebuilding Ugh!
#!/bin/sh
# Turn off spotlight.
sudo mdutil -a -i off
# Remove the index files.
sudo rm -rfv /.Spotlight-V100
# Turn on spotlight.
sudo mdutil -a -i on
@ssaadh
ssaadh / disable-reopening-apps-windows-MacOS-modern-versions-post-Lion
Last active April 12, 2017 15:52
Disables the reopening of applications and windows for modern MacOS versions. For some reason on the latest Sierra patch, my apps and windows are reopening.
#!/bin/bash
# curl https://gist.githubusercontent.com/inoicouldalwaysturn2u/69042c23228578a6725a298ae5ac7fe2/raw/9c6b3d51281c9e7d3883fbc644aa968fe1768a01/disable-reopening-apps-windows-MacOS-modern-versions-post-Lion -L -s -o ~/.local/bin/fixlogin.sh
# chmod +x ~/.local/bin/fixlogin.sh && sudo ~/.local/bin/fixlogin.sh ; rm ~/.local/bin/fixlogin.sh
echo "#!/bin/bash" > /tmp/loginfix.sh
echo "rm /Users/*/Library/Preferences/ByHost/com.apple.loginwindow.*" >> /tmp/loginfix.sh
mv /tmp/loginfix.sh /usr/local/bin/loginfix.sh
chmod +x /usr/local/bin/loginfix.sh
defaults write com.apple.loginwindow LoginHook /usr/local/bin/loginfix.sh
@ssaadh
ssaadh / wget
Created March 18, 2017 15:53 — forked from bueckl/wget
Wget examples
#Spider Websites with Wget – 20 Practical Examples
Wget is extremely powerful, but like with most other command line programs, the plethora of options it supports can be intimidating to new users. Thus what we have here are a collection of wget commands that you can use to accomplish common tasks from downloading single files to mirroring entire websites. It will help if you can read through the wget manual but for the busy souls, these commands are ready to execute.
1. Download a single file from the Internet
wget http://example.com/file.iso
2. Download a file but save it locally under a different name
wget ‐‐output-document=filename.html example.com
@ssaadh
ssaadh / youtube api video category id list
Created November 17, 2016 15:03 — forked from dgp/youtube api video category id list
youtube api video category id list
2 - Autos & Vehicles
1 - Film & Animation
10 - Music
15 - Pets & Animals
17 - Sports
18 - Short Movies
19 - Travel & Events
20 - Gaming
21 - Videoblogging
22 - People & Blogs
# because I'll already have a chromedriver installed
sudo mv -f /usr/local/bin/chromedriver /usr/local/bin/chromedriver-old
sudo apt-get install unzip &&
a=$(uname -m) &&
rm -r /tmp/chromedriver/
mkdir /tmp/chromedriver/ &&
wget -O /tmp/chromedriver/LATEST_RELEASE http://chromedriver.storage.googleapis.com/LATEST_RELEASE &&
if [ $a == i686 ]; then b=32; elif [ $a == x86_64 ]; then b=64; fi &&
latest=$(cat /tmp/chromedriver/LATEST_RELEASE) &&
wget -O /tmp/chromedriver/chromedriver.zip 'http://chromedriver.storage.googleapis.com/'$latest'/chromedriver_linux'$b'.zip' &&