Skip to content

Instantly share code, notes, and snippets.

Avatar
😃

Luis Nell originell

😃
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am originell on github.
  • I am luisnell (https://keybase.io/luisnell) on keybase.
  • I have a public key ASBSXlh0oSykmXPzBbtfCfhn7L78G_MEjr3WiytHvw1U-go

To claim this, I am signing this object:

@originell
originell / PATH.md
Last active Jan 11, 2019
Small Fish Intro
View PATH.md

Notes about $PATH

You are probably used to lines like these in your shell config:

export PATH="/usr/local/opt/gettext/bin:$PATH"

Now, $PATH can also be modified like this in fish. However, it would not be very idiomatic.

View keybase.md

Keybase proof

I hereby claim:

  • I am originell on github.
  • I am luisnell (https://keybase.io/luisnell) on keybase.
  • I have a public key ASB2zMHH4q3XTjUnERLfXYbpsesbZbpZpfo-FhUDUDffMgo

To claim this, I am signing this object:

@originell
originell / navStyleChanger.js
Last active Aug 29, 2015
Example: detect scroll position and change navi style
View navStyleChanger.js
// Navigationbar to be changed (cached here for performance, always grabbing
// it new in the scroll-callback is bad for performance)
var $navi = $('.myNav')
function changeNavStyle() {
var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop;
if (top > 200) {
$navi.addClass('.myNewStyle-Yo')
} else {
@originell
originell / TopMostViewController.swift
Created Jan 7, 2015
Reliably get the top most UIViewController. Tested with iOS7 and 8
View TopMostViewController.swift
// Note: There are no fancy error checks in here. This is just meant to quickly demonstrate this.
// I was extremely frustrated because most posts on stackoverflow are missing the important point
// of checking for the "presentedViewController".
// If you are working in a view that is *already living* in the view hierarchy.
var topMostController = view.window!.rootViewController!
// or
// If you don't have a view in the hierarchy yet (as it might happen in viewDidLoad etc.)
// (there is also the possibility to use UIApplication.sharedApplication().keyWindow, though it seems
// that the internet's general opinion is that it's safer to use the delegate's window)
@originell
originell / RubberBand.md
Last active Oct 9, 2020
This is a straight copy of – to avoid this ever going dark http://squareb.wordpress.com/2013/01/06/31/
View RubberBand.md

Analysis of Apple’s rubber band scrolling

January 6, 2013

I recently saw a post on Twitter from @chpwn that described the alogorithm that Apple uses for its “rubber band” or “bungee” scrolling.

b = (1.0 – (1.0 / ((x * c / d) + 1.0))) * d
@originell
originell / extract_exceptions.py
Created Feb 27, 2012
Python Traceback Extractor from text/log files.
View extract_exceptions.py
"""
Extract unique Python-Exceptions with their Traceback from a log/text file.
Usage::
python extract_exceptions.py -f logfile.txt
Furthermore it supports excluding exceptions you don't want to have::
python extract_exceptions.py -f logfile.txt -e ValueError,AttributeError
@originell
originell / form_to_array.py
Created May 11, 2011
XHTML 1.1 form to PHP Array.
View form_to_array.py
# coding: utf-8
"""
Convert a XHTML 1.1 compliant form to a php array with Python (YIKES! :D)
"""
import re
# Put your form in here!
s = """
<form action="foobar.php" method="post" accept-charset="utf8">
@originell
originell / test.py
Created May 4, 2011
Fastes way to search for something in a list
View test.py
import pytz
import re
"""
Trying to find a fast way to search through a list.
As example we use pytz's all_timezones list and set, which
are both pretty nicely filled with strings.
OSX 10.6.7, 2.53ghz Core2Duo:
@originell
originell / uri_regex_test.py
Created Apr 22, 2011
Trying to build a regex validating the given URIs
View uri_regex_test.py
#!/usr/bin/env python
# encoding: utf-8
"""
Build URL Validation Regex.
See the according *\_urls list for a definition of what we
want to match and what not.
Note that according to RFC 2612 (HTTP 1.1, Section 3.1.2) there is
no such thing as a maximum URI length. Since servers should
You can’t perform that action at this time.