Skip to content

Instantly share code, notes, and snippets.

View detection.js
/* Detection: http://gist.github.com/df3fd4016e632344336f3227a6f159e6
* While userAgent sniffing is not ideal, arguably it is best in most cases
* throw in some proper feature detection & this will give you vast UI/UX control
*/
var userAgent = navigator.userAgent || navigator.vendor || window.opera || navigator.platform;
this.isMobile = (function (browserUserAgent) { return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(browserUserAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|n
@baharev
baharev / rolling_window.py
Created Jun 4, 2018 — forked from seberg/rolling_window.py
Multidimensional rolling_window for numpy
View rolling_window.py
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple
@baharev
baharev / s3gzip.py
Created May 21, 2018 — forked from veselosky/s3gzip.py
How to store and retrieve gzip-compressed objects in AWS S3
View s3gzip.py
# vim: set fileencoding=utf-8 :
#
# How to store and retrieve gzip-compressed objects in AWS S3
###########################################################################
#
# Copyright 2015 Vince Veselosky and contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@baharev
baharev / tsv-to-json.js
Created May 21, 2018 — forked from iwek/tsv-to-json.js
TSV to JSON Conversion in JavaScript
View tsv-to-json.js
//var tsv is the TSV file with headers
function tsvJSON(tsv){
var lines=tsv.split("\n");
var result = [];
var headers=lines[0].split("\t");
for(var i=1;i<lines.length;i++){
@baharev
baharev / solvable.py
Created Jul 19, 2017
Finding the safe eliminations automatically
View solvable.py
# Copyright (C) 2017 University of Vienna
# All rights reserved.
# BSD license.
# Author: Ali Baharev <ali.baharev@gmail.com>
from __future__ import division, print_function
from collections import OrderedDict
import sympy as sp
import imp
from six import exec_
@baharev
baharev / iosdtrace.md
Created Jul 6, 2016 — forked from proger/iosdtrace.md
iosdtrace.md
View iosdtrace.md

DTrace Sessions for iOS Development

DTrace is a comprehensive dynamic tracing framework created by Sun Microsystems for troubleshooting kernel and application problems on production systems in real time. Originally developed for Solaris, it has since been released to open source community in 2004 and has been ported to several other Unix systems.

Apple ported DTrace for OS X Leopard, including a GUI called Instruments and made it co-exist with the existing legacy stack of performance troubleshooting toolkits.

We are going to tame this beast to help us hunt down and eliminate all sorts of application and system-wide troubles when doing development of iOS and OS X apps.

the chat

View Main.hs
data Lit = Lit Int
data Add l r = Add l r
class Eval x where
eval :: x -> Int
instance Eval Lit where
eval (Lit x) = x
instance (Eval l, Eval r) => Eval (Add l r) where
View O2
.file "main.cpp"
.text
.p2align 4,,15
.type _ZL3addRKiS0_.isra.0, @function
_ZL3addRKiS0_.isra.0:
.LFB3:
.cfi_startproc
leal (%rdi,%rsi), %eax
ret
.cfi_endproc
View Os
.file "main.cpp"
.text
.type _ZL3addRKiS0_.isra.0, @function
_ZL3addRKiS0_.isra.0:
.LFB3:
.cfi_startproc
leal (%rdi,%rsi), %eax
ret
.cfi_endproc
.LFE3: