Skip to content

Instantly share code, notes, and snippets.

var standalone = window.navigator.standalone,
userAgent = window.navigator.userAgent.toLowerCase(),
safari = /safari/.test( userAgent ),
ios = /iphone|ipod|ipad/.test( userAgent );
if( ios ) {
if ( !standalone && safari ) {
//browser
} else if ( standalone && !safari ) {
//standalone
@opencoca
opencoca / flexbox.css
Last active January 29, 2018 15:50
Flexbox Layout
/*
The Flexbox Layout (Flexible Box) module (currently a W3C Last Call Working Draft) aims at providing a more efficient way to lay out, align and distribute space among items in a container, even when their size is unknown and/or dynamic (thus the word "flex").
The main idea behind the flex layout is to give the container the ability to alter its items' width/height (and order) to best fill the available space (mostly to accommodate to all kind of display devices and screen sizes). A flex container expands items to fill available free space, or shrinks them to prevent overflow.
*/
.section {
margin: auto;
max-width: 72em;
}
# Display list of screen panes on bottom of screen
caption always "%= %-w%L>%{= BW}%n*%t%{-}%52<%+w %L="
shelltitle "$ |bash"
# change terminal title depending on screen pane title
termcapinfo xterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007'
defhstatus "screen ^E (^Et) | $USER@^EH"
hardstatus off
# don't display the copyright page
startup_message off
#!/bin/sh
while inotifywait -e modify .; do
lessc style.less > style.css
NOW=(date +"%T")
echo "$NOW : compiled style.less"
done
@opencoca
opencoca / django-filer-backup.py
Created March 31, 2017 23:26
A simple little script that exports django filer files.
import os
import filer
from shutil import copyfile
def ensure_dir(file_path):
if not os.path.exists(file_path):
os.makedirs(file_path)
backup_dir = "/backup_dir"
@opencoca
opencoca / search.py
Last active February 12, 2022 21:43
Python Sqlite search for string
import sqlite3
import os
filename = "simple.db"
search = "search"
with sqlite3.connect(filename) as conn:
conn.row_factory = sqlite3.Row
cursor = conn.cursor()
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
for tablerow in cursor.fetchall():