Skip to content

Instantly share code, notes, and snippets.

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

Binyamin Laukstein laukstein

🏠
Working from home
View GitHub Profile
@mathiasbynens
mathiasbynens / LICENSE.txt
Created May 23, 2011 07:47 — forked from 140bytes/LICENSE.txt
Google Analytics snippet in 140 bytes
Author: Mathias Bynens <http://mathiasbynens.be/>
This code is licensed under the WTFPL. Feel free to relicense as needed.
@Rob-ot
Rob-ot / prefixedCalc.js
Created August 20, 2012 01:23
Detect which prefixed css calc to use via javascript
// public domain, use it for whatever
// returns "calc", "-moz-calc", etc
// (no -ms because they already support it non-prefixed)
function prefixedCalc () {
var prefixes = ["","-webkit-","-moz-","-o-"], el
for (var i = 0; i < prefixes.length; i++) {
el = document.createElement('div')
el.style.cssText = "width:" + prefixes[i] + "calc(9px)"
if (el.style.length) return prefixes[i] + "calc"
@igrigorik
igrigorik / file.html
Created July 6, 2012 08:01
Example of early head flush on load time
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hello</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
Hello World
</body>
@luk-
luk- / http_build_query.js
Created May 17, 2012 22:42
php's http_build_query() in javascript
var build_query = function (obj, num_prefix, temp_key) {
var output_string = []
Object.keys(obj).forEach(function (val) {
var key = val;
num_prefix && !isNaN(key) ? key = num_prefix + key : ''
@khal3d
khal3d / is_rtl.php
Last active September 15, 2022 03:26
Check if there RTL characters (Arabic, Persian, Hebrew)
<?php
/**
* Is RTL
* Check if there RTL characters (Arabic, Persian, Hebrew)
*
* @author Khaled Attia <sourcecode@khal3d.com>
* @param String $string
* @return bool
*/
@azu
azu / Medium: remove location hash.user.js
Created December 2, 2015 15:05
Medium: remove location hash
// ==UserScript==
// @name Medium: remove location hash
// @namespace http://efcl.info/
// @description Remove location hash from medium
// @include https://medium.com/*#*
// @version 1
// @grant none
// ==/UserScript==
function removeLocationHash(){
@Salakar
Salakar / deepMerge.md
Last active November 22, 2023 09:02
ES6/ES2015 Object deep merge

Deep Merge

Quick function to deep merge using Object.assign(). Thoughts?

    /**
     * Simple is object check.
     * @param item
     * @returns {boolean}
     */
@dalethedeveloper
dalethedeveloper / gist:1503252
Created December 20, 2011 21:00
Mobile Device Detection via User Agent RegEx

#Mobile Device Detection via User Agent RegEx

Yes, it is nearly 2012 and this exercise has been done to death in every imaginable language. For my own purposes I needed to get the majority of non-desktop devices on to a trimmed down, mobile optimized version of a site. I decided to try and chase down an up-to-date RegEx of the simplest thing that could possibly work.

I arrived at my current solution after analyzing 12 months of traffic over 30+ US based entertainment properties (5.8M+ visitors) from Jan - Dec 2011.

The numbers solidified my thoughts on the irrelevancy of including browsers/OSes such as Nokia, Samsung, Maemo, Symbian, Ipaq, Avant, Zino, Bolt, Iris, etc. The brass tacks of the matter is that you certainly could support these obscure beasts, but are you really going to test your site on them? Heck, could you even find one?! Unless the folks that pay you are die hard Treo users my guess is "No".

Interestingly enough my research shows that /Mobile/ is more efficient than **/iP(

@joaocunha
joaocunha / How To Hide The Select Arrow On Firefox.md
Last active December 10, 2023 13:05
How to hide <select> dropdown's arrow in Firefox when using "-moz-appearance: none;".

This is no longer a bug. I'm keeping the gist for historical reasons, as it helped to get it fixed. Make sure to read the notes by the end of the post.

How to remove hide the select arrow in Firefox using -moz-appearance:none;

TL;DR (or, the fix)

  1. Set -moz-appearance to none. This will "reset" the styling of the element;
  2. Set text-indent to 0.01px. This will "push" the text a tiny bit[1] to the right;
@jbroadway
jbroadway / Slimdown.md
Last active February 5, 2024 10:43
Slimdown - A simple regex-based Markdown parser.