Skip to content

Instantly share code, notes, and snippets.

View trainoasis's full-sized avatar
🚲
Outside

Jernej Oblak trainoasis

🚲
Outside
View GitHub Profile
@trainoasis
trainoasis / main.py
Created July 12, 2021 10:05
Largest distinct substring
def all_unique(s):
d = set()
for c in s:
if c in d:
return False
else:
d.add(c)
return True
@trainoasis
trainoasis / .htaccess
Created August 3, 2021 11:06
Force HTTPS (works on Nuxt JS)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
@trainoasis
trainoasis / index.html
Last active March 14, 2024 09:45
Tailwind 2 + Vanilla JS: dropdown search results component (with functional search)
<!-- Make sure to include the script.js of course ... -->
<!-- Also, adjust "school" and "school-text" fields as required, both here and in script.js ... -->
<label class="block relative">
<span class="text-gray-700">Select school</span>
<input id="school" type="hidden" required class="hidden" />
<input id="school-text" required type="text" class="mt-1 block w-full" placeholder="Select school" />
<div id="search-results" class="absolute hidden border border-2 max-h-60 mt-3 overflow-scroll bg-white p-3 w-full">
<div id="no-results-txt" class="hidden">No results</div>
<ul id="search-list" class="h-100">