Skip to content

Instantly share code, notes, and snippets.

// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@irae
irae / _Stay_standalone.md
Last active January 29, 2024 12:38 — forked from kylebarrow/example.html
Stay Standalone: Prevent links in standalone web apps opening Mobile Safari

#Stay Standalone

A short script to prevent internal links to a "webapp" added to iPhone home screen to open in Safari instead of navigating internally.

@Zegnat
Zegnat / README.md
Created February 24, 2012 12:03
Fixing your skip links. [JS]

Fixing your skip links.

Read Damon Muma on this. He proposes the following jQuery solution (inspired by Thompson, fixed by me):

// Apply focus properly when accessing internal links with keyboard in WebKit browsers.
$("a[href^='#']").not("a[href='#']").click(function() {
   $("#"+$(this).attr("href").slice(1)+"").focus();
});
@mbeale
mbeale / gist:4247971
Created December 10, 2012 02:01
Dynamic JSON sample golang #4
type JSONContainer struct {
data []interface{}
}
func (j *JSONContainer) All() (objects []JSONObject) {
for _, v := range j.data {
objects = append(objects, JSONObject{data: v})
}
return
}
@toblerpwn
toblerpwn / CustomCollectionFlowLayout.h
Last active April 5, 2022 22:11
Sticky Headers at the top of a UICollectionView! -- // -- http://stackoverflow.com/questions/13511733/how-to-make-supplementary-view-float-in-uicollectionview-as-section-headers-do-i -- // -- still needs work around contentInsets.bottom and oddly-sized footers.
//
// CustomCollectionFlowLayout.h
// evilapples
//
// http://stackoverflow.com/questions/13511733/how-to-make-supplementary-view-float-in-uicollectionview-as-section-headers-do-i
//
//
#import <UIKit/UIKit.h>
@MarcDiethelm
MarcDiethelm / strongloop-heroku.md
Last active July 17, 2019 05:59
How to install a Node.js app using Strongloop on Heroku

How to install a Node.js app using Strongloop on Heroku

with different environments like staging and production no less! new: now with multiple account administration!

  1. Create a Node.js app as you would normally, managing your dependencies with npm in package.json.
  2. Your app should be set up to listen on process.env.STRONGLOOP_PORT || [your usual local port].
  3. Download and install the Heroku toolbelt. This install includes git.

➽ If you need to handle multiple accounts, install the accounts plugin.

@backflip
backflip / bower.json
Last active August 30, 2019 12:03 — forked from GFoley83/load-google-maps.js
Load Google Maps API using jQuery Deferred
{
"name": "load-google-maps",
"version": "1.0.0",
"main": ["./load-google-maps.js"],
"author": "Glenn Baker & Gavin Foley",
"dependencies": {
"jquery": ">=1.5"
},
"license": ["MIT", "GPL"],
"keywords": ["Google Maps", "Async"]
@d-simon
d-simon / iterator_async_callback.js
Created March 7, 2014 00:49
For-Loop / Pass iterator into async callback
for (var i = 0; i < array.length; i++) (function (i, arrayElement) {
// this will create a new variables i and arrayElement for each loop iteration
// so we can use it in an async callback
doSomeAsync(function callback () {
console.log(i, arrayElement);
});
}) (i, array[i]);
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Created April 3, 2014 07:41
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// Hacking made easy
// ---
// A couple of Sass functions
// To ease the pain of dealing
// With special values for IE
@Jakobud
Jakobud / bootstrap-ms.scss
Last active June 15, 2022 12:42 — forked from andyl/bootstrap_ms.css.scss
Adds in the missing 480px-797px breakpoint range to Bootstrap 3 for SASS
// Bootstrap Mid-Small - col-ms-* - the missing grid set for Bootstrap3.
//
// This is a hack to fill the gap between 480 and 767 pixels - a missing range
// in the bootstrap responsive grid structure. Use these classes to style pages
// on cellphones when they transition from portrait to landscape.
//
// Contains:
// Columns, Offsets, Pushes, Pulls for the Mid-Small layout
// Visibility classes for the Mid-Small layout
// Redefined visibility classes for the Extra Small layout