Skip to content

Instantly share code, notes, and snippets.

View stefanmaric's full-sized avatar
🐿️
ship it

Stefan Maric stefanmaric

🐿️
ship it
View GitHub Profile
@stefanmaric
stefanmaric / mostUsed.md
Last active December 21, 2015 19:49
Unicode Characters / Faces / Emoticons

Creepy

ಠ‿ಠ

ಠ⌣ಠ

כּ‗כּ

ó‿ó

@stefanmaric
stefanmaric / gist:8599834
Created January 24, 2014 15:45
Fix for Atheros AR5005G unstable wireless connection issue in Linux - AR2413/AR2414

Ethernet controller: Atheros Communications Inc. AR2413/AR2414 Wireless Network Adapter [AR5005G(S) 802.11bg]

Test & try:

sudo rmmod ath5k
@stefanmaric
stefanmaric / btn-pill.less
Last active December 16, 2015 03:21
.btn-pill class in LESS to include with Bootstrap's less files.
// Button styles
// -------------------------
// Pill button variants
.btn.btn-pill {
// border-radius depends on button' height
@border-radius-pill: (@font-size-base * @line-height-base + @padding-base-vertical * 2) / 2;
border-radius: @border-radius-pill;
@stefanmaric
stefanmaric / areEquivalents.js
Last active September 2, 2016 03:15
Recursive areEquivalents function.
function areEquivalents (a, b) {
if (a && b && typeof a === 'object' && typeof a === typeof b && a.length === b.length) {
for (var prop in a) {
if (a.hasOwnProperty(prop) && !areEquivalents(a[prop], b[prop])) {
return false
}
}
for (var prop in b) {
if (b.hasOwnProperty(prop) && !areEquivalents(b[prop], a[prop])) {
return false
@stefanmaric
stefanmaric / open-sans.css
Created June 16, 2015 17:48
All (13) Open Sans variants. CSS embedded. WOFF format. Base64 encoded. Basic Western subsetting. font-face declaration using style links.
/* Open Sans - by Steve Matteson, Apache License version 2.0 */
/* Open Sans Light */
@font-face {
font-family: 'Open Sans';
src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAF5IABMAAAAArgwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABqAAAABwAAAAca7DAFEdERUYAAAHEAAAAHQAAAB4AJwDwR1BPUwAAAeQAAASiAAAJmCwaFlhHU1VCAAAGiAAAAIEAAACooF6Ikk9TLzIAAAcMAAAAXgAAAGCgeJYXY21hcAAAB2wAAAGGAAAB2s9AWKBjdnQgAAAI9AAAADgAAAA4ClINZmZwZ20AAAksAAABsQAAAmVTtC+nZ2FzcAAACuAAAAAIAAAACAAAABBnbHlmAAAK6AAASiYAAI54OERAeGhlYWQAAFUQAAAAMwAAADYJcp/SaGhlYQAAVUQAAAAfAAAAJA9bBixobXR4AABVZAAAAjEAAAOmuKtcmWxvY2EAAFeYAAABzgAAAdZKMihUbWF4cAAAWWgAAAAgAAAAIAIHAc1uYW1lAABZiAAAAhoAAATiYqqsfHBvc3QAAFukAAAB6wAAAt17wozucHJlcAAAXZAAAACvAAABLyQjUqh3ZWJmAABeQAAAAAYAAAAG7WNVfgAAAAEAAAAA0MoNVwAAAADJQhTbAAAAANGkneF42mNgZGBg4AFiMSBmYmAEwpdAzALmMQAADaEBGAAAAHjarZZLbFRVGMf/M51hxoKWqtH4CBoyNrUGjQ1J27GwatpaDZZpi4MOig/iAkJCY0hMExaFgbgwIQYrOTxqCkyh0FmQUpryMkxXLNzhaW3jyuVJV8QFIY6/c9sp4EjVxHz55dw597vf43/OPXMVklSpbn2qSEvru916/rOvenep5oveHTtVv+uTL3dro
@stefanmaric
stefanmaric / deep-diff-angular.js
Last active September 2, 2016 03:22
Deep (recursive) diff function implementation in Angular, lodash and ES6 / ES2015.
function deepDiffRight (left, right) {
// if they are equals, return undefined
if (angular.equals(left, right)) return
// form now on, we can assure that `left` and `right` are not equals (equivalents)
// if `left` and `right` are primitives, value changed
// if `left` is a primitive and `right` an object, value has been replaced with an object
// if `left` is an object and `right` a primitive, value has been replaced with a primitive
// use `_.copy` to prevent object referrence issues
if (!angular.isObject(left) || !angular.isObject(right)) return angular.copy(right)
@stefanmaric
stefanmaric / copy-to-clipboard-bookmarklet.md
Created September 7, 2016 20:54
Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard

Copy-to-clipboard Bookmarklet

Create Bookmarklet (browser bookmark that executes Javsacript) to copy a given text to Clipboard.

This is the base javascript:

(function (text) {
  var node = document.createElement('textarea')
  var selection = document.getSelection()
@stefanmaric
stefanmaric / flattenObject.es5.js
Last active March 22, 2018 20:09
Flatten object function in plain ES5 javascript and ES2015
'use strict'
function flatten (source, dest, separator, path) {
dest = typeof dest !== 'undefined' ? dest : {}
separator = typeof separator !== 'undefined' ? separator : '-'
path = typeof path !== 'undefined' ? path : []
for (var key in source) {
if (!source.hasOwnProperty(key)) continue
@stefanmaric
stefanmaric / notes.md
Last active February 11, 2023 04:51
CleverKek notes

y-combinator

const y = le => (f => f(f))(f => le(x => f(f)(x)))

fib func that would theoretically take advantage of TCO

'use strict'
const fib = (n, a = 1, b = 0) => n ? fib(n - 1, a + b, a) : b