Skip to content

Instantly share code, notes, and snippets.

View nilsFK's full-sized avatar
🏠
Working from home

Nils F. Karlsson nilsFK

🏠
Working from home
View GitHub Profile
@deadkarma
deadkarma / gist:1989808
Created March 6, 2012 23:39 — forked from rails/gist:58761
Calculate time_ago_in_words for javascript
var DateHelper = {
// Takes the format of "Jan 15, 2007 15:45:00 GMT" and converts it to a relative time
// Ruby strftime: %b %d, %Y %H:%M:%S GMT
time_ago_in_words_with_parsing: function(from) {
var date = new Date;
date.setTime(Date.parse(from));
return this.time_ago_in_words(date);
},
// Takes a timestamp and converts it to a relative time
// DateHelper.time_ago_in_words(1331079503000)
@nicferrier
nicferrier / gist:2277987
Created April 1, 2012 19:34
Clone a git repo if it does not exist, or pull into it if it does exist
#!/bin/sh
REPOSRC=$1
LOCALREPO=$2
# We do it this way so that we can abstract if from just git later on
LOCALREPO_VC_DIR=$LOCALREPO/.git
if [ ! -d $LOCALREPO_VC_DIR ]
then
.fc {
direction: ltr;
text-align: left; }
.fc table {
border-collapse: collapse;
border-spacing: 0; }
.fc .btn {
line-height: 1.2em; }
html .fc {
@awidegreen
awidegreen / vim_cheatsheet.md
Last active October 27, 2024 12:13
Vim shortcuts

Introduction

  • C-a == Ctrl-a
  • M-a == Alt-a

General

:q        close
:w        write/saves
:wa[!]    write/save all windows [force]
:wq       write/save and close
@utek
utek / Exclude_tables.md
Last active June 6, 2024 08:11
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

    import re 
    
@bkdinoop
bkdinoop / login-example
Last active May 21, 2024 06:25
Flask-Login : login.py created by https://github.com/maxcountryman : Matthew Frazier
# -*- coding: utf-8 -*-
"""
Flask-Login example
===================
This is a small application that provides a trivial demonstration of
Flask-Login, including remember me functionality.
:copyright: (C) 2011 by Matthew Frazier.
:license: MIT/X11, see LICENSE for more details.
"""
/sbin/ifconfig en0 ether $(/usr/bin/openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
@nilsFK
nilsFK / Git Aliases
Last active August 29, 2015 14:00
GIT aliases
[alias]
# Basic commands
ignored = git ls-files -v | grep \"^[[:lower:]]\"
st = status -s
stat = status
ci = commit
co = checkout
br = branch
brav = branch -av
unstage = reset HEAD --
@qgerome
qgerome / diff_freeze.py
Created May 9, 2014 08:52
How to compare or diff 2 pip freeze or 2 requirements.txt in Python
"""
pip install click
"""
import click
import itertools
@nilsFK
nilsFK / SublimeLinter.sublime-settings
Last active July 23, 2018 16:15
SublimeLinter settings for Sublime3+htmltidy+Angular
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Danish Royalty/Danish Royalty.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "load/save",
"linters": {
"htmltidy": {