Skip to content

Instantly share code, notes, and snippets.

View RafhaanShah's full-sized avatar
💭
🚀

Rafhaan Shah RafhaanShah

💭
🚀
View GitHub Profile
@RafhaanShah
RafhaanShah / wix-dynamic-pdf.js
Last active December 20, 2022 10:27
Wix Stuff
// https://www.wix.com/velo/forum/community-discussion/how-to-embed-a-pdf-on-a-dynamic-page-tutorial
// https://www.wix.com/velo/forum/community-discussion/creating-a-viewable-pdf-in-wix
import wixData from 'wix-data';
import wixLocation from 'wix-location';
let src;
$w.onReady(function() {
$w("#dataset1").onReady(() => {
const item = $w('#dataset1').getCurrentItem();
@RafhaanShah
RafhaanShah / Monoaki.tmTheme
Last active February 18, 2022 22:25
Monokai for various IDEs and Terminals
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Monokai</string>
@RafhaanShah
RafhaanShah / kiosk.sh
Last active December 10, 2020 13:24
Use Raspberry Pi as a Chrome kiosk
#!/bin/bash
set -e
export DISPLAY=:0.0
# add to /etc/xdg/lxsession/LXDE-pi/autostart
# unclutter -idle 5
# @xset s noblank
# @xset s off
# @xset -dpms
@RafhaanShah
RafhaanShah / git-duet.sh
Created January 7, 2021 20:52
Shell function for git duet commits
git-duet() {
if [ "$#" -lt 3 ]; then
echo "Usage: git-duet \"Commit message\" \"Second Committer\" \"second.committer@mail.com\""
else
git commit --message "$1" --author "$2 <$3>" --signoff
fi
}
#!/usr/bin/env sh
# exit on any error, unset variable
set -eu
# checks if a specific file (such as a version file) has been updated before commit
FILE="file.txt"
if ! git diff --cached "${FILE}"; then
@RafhaanShah
RafhaanShah / hooks-stuff.sh
Last active March 8, 2021 15:27
Random Git Hook Stuff
#!/bin/sh
# exit on any error, unset variable, or failed piped commands
set -euo pipefail
# set hooks path
git config core.hooksPath ".git-hooks"
chmod -R +x "$(git rev-parse --git-path hooks)"
# check if command is installed
@RafhaanShah
RafhaanShah / MockWebServerRule.kt
Last active June 30, 2021 07:55
Android Integration Test Rule for OkHttpMockWebServer with Matching Request Dispatching
import android.util.Log
import com.miniweather.util.Empty
import okhttp3.mockwebserver.Dispatcher
import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer
import okhttp3.mockwebserver.QueueDispatcher
import okhttp3.mockwebserver.RecordedRequest
import org.junit.rules.ExternalResource
import java.io.IOException
import java.util.ArrayDeque
@RafhaanShah
RafhaanShah / android-studio-scopes.txt
Created July 2, 2021 08:33
Better Android Studio Search Scopes
// https://www.jetbrains.com/help/idea/settings-scopes.html
App Files:
(src:*..*)&&!file:*intermediates*/&&!file:*generated*/&&!file:*build*/
App and Test:
(src:*..*||test:*..*)&&!file:*intermediates*/&&!file:*generated*/&&!file:*build*/
Test:
(test:*..*)&&!file:*intermediates*/&&!file:*generated*/&&!file:*build*/
@RafhaanShah
RafhaanShah / import-location-history.py
Last active January 29, 2022 17:05
Google Location History -> OwnTracks Importer
#!/usr/bin/env python3
# forked from https://github.com/owntracks/tools/blob/master/Google/import-location-history.py
# docs: https://owntracks.org/booklet/tech/json/
# replace:
# hostname/ip
# topic user device
# filename
# TID tracker ID
@RafhaanShah
RafhaanShah / manifest.json
Created January 12, 2022 10:09
Google Tasks Shortcut
{
"app": {
"launch": {
"urls": [
"https://tasks.google.com/embed/?origin=https://calendar.google.com&fullWidth=1"
],
"web_url": "https://tasks.google.com/embed/?origin=https://calendar.google.com&fullWidth=1",
"container": "tab"
}
},