Skip to content

Instantly share code, notes, and snippets.

View taimursaeed's full-sized avatar

Taimur Saeed taimursaeed

View GitHub Profile
@taimursaeed
taimursaeed / touchCSSQueries.css
Last active March 13, 2020 07:47
Target Touch Screens Via CSS Queries
@media (pointer: none), (pointer: coarse) {
}
//via https://stackoverflow.com/a/50302305/4882234
/* smartphones, touchscreens */
@media (hover: none) and (pointer: coarse) {
/* ... */
}
@taimursaeed
taimursaeed / .htaccess
Last active March 18, 2020 15:45
Leverage browser cache and server compression
# Enable Compression
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
@taimursaeed
taimursaeed / script.js
Created March 20, 2020 09:53
Wait for CSS transition to complete
// wait for css transition to complete
$(".class").on(
"transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",
function() {
$(this).css({
//do stuff
});
}
);
@taimursaeed
taimursaeed / script.js
Created March 21, 2020 07:39
Wait for CSS animation to complete
// wait for css animation to complete
$(".class").on(
"animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",
function() {
$(this).css({
//do stuff
});
}
);
@taimursaeed
taimursaeed / git.txt
Last active December 16, 2020 16:35
Everything related to Git
// Delete local branches that are no longer present on remote
git branch --v | ? { $_ -match "\[gone\]" } | % { -split $_ | select -First 1 } | % { git branch -D $_ }
@taimursaeed
taimursaeed / choco.bat
Last active July 29, 2021 06:29
Programs from chocolatey for initial windows setup
:: Run in Command Prompt (cmd.exe) [admin mode]
:: This script will install both the Chocolately .exe file and add the
:: choco command to your PATH variable
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco upgrade -y chocolatey
choco install -y googlechrome
choco install -y firefox
choco install -y figma
choco install -y zeplin
@taimursaeed
taimursaeed / quoteEscaping.js
Created January 21, 2022 14:05
Escape/Unescape quotes from a string
var utility = {
escapeDoubleQuotes: function (string) {
return string.replace(/"/g, "&quot;");
},
unescapeDoubleQuotes: function (string) {
return string.replace(/&quot;/g, '"');
},
escapeSingleQuotes: function (string) {
return string.replace(/'/g, "&apos;");
@taimursaeed
taimursaeed / test.json
Created September 20, 2023 12:35
test json
This file has been truncated, but you can view the full file.
[{"directed": false, "multigraph": false, "graph": {}, "nodes": [{"vector": [7.066966569399334, 2.749834415266431, 9.654323698094382, 4.342081102481657, 8.6837444666177, 1.152149390095376, 9.284546192988673, 2.1856144539984097, 9.128073012240225, 4.245839499494405], "id": 0}, {"vector": [6.648227611344847, 8.677634162634119, 2.249929756709019, 3.3260803985757033, 9.529832902764314, 2.4714168029504355, 9.472342794661113, 3.815617083634624, 7.424415434763656, 8.214467240496939], "id": 1}, {"vector": [4.989400235738187, 9.817664152603843, 3.9701128307527185, 3.958013352288618, 5.248772439844505, 6.169843795928262, 2.2533391176207047, 7.025764146720871, 2.706441295372815, 5.683913842161204], "id": 2}, {"vector": [9.001671711265567, 8.76622517807592, 1.0707939316282644, 5.582821408488472, 1.011911640477182, 4.018011306755672, 8.03728860312817, 1.4066613319002688, 8.933619751146846, 6.728319728957616], "id": 3}, {"vector": [2.788371050681322, 3.175429500768968, 3.315576577311859, 3.433543243990881, 8.06181099847660