Skip to content

Instantly share code, notes, and snippets.


Jernej Oblak trainoasis

View GitHub Profile
trainoasis / .htaccess
Created Aug 3, 2021
Force HTTPS (works on Nuxt JS)
View .htaccess
<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]
trainoasis /
Created Jul 12, 2021
Largest distinct substring
def all_unique(s):
d = set()
for c in s:
if c in d:
return False
return True
trainoasis / index.html
Last active Apr 1, 2021
Tailwind 2 + Vanilla JS: dropdown search results component (with functional search)
View index.html
<!-- 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">