Skip to content

Instantly share code, notes, and snippets.

@jehoshua02
jehoshua02 / scrollCap.js
Last active August 29, 2015 14:05
Prevent over-scroll, scroll freeze, scroll "bounce", or whatever you call it, on Safari Mobile.
var scrollCap = function ($element) {
$element.on('touchstart.scroll-cap', function(event){
var $element = $(this);
var scrollTop = $element.scrollTop();
var contentHeight = $element.get(0).scrollHeight;
var minScrollTop = 1;
var maxScrollTop = contentHeight - $element.height() - 1;
if(scrollTop < minScrollTop){
$element.scrollTop(minScrollTop);
@jehoshua02
jehoshua02 / styleSupported.js
Created September 5, 2014 01:04
Check if a style property is supported.
var styleSupported = (function () {
var supported = [];
var check = function (property) {
var body = document.body || document.documentElement;
var style = body.style;
// check for standard
if (typeof style[property] == 'string') { return true; }
@jehoshua02
jehoshua02 / z-index.md
Last active August 29, 2015 14:06
Standardizable rules for z-index values.
z-index Element
500 Flash Messages
401 Modal
400 Modal Overlay
300 Menu
200 Header
100 Content Overlay
0-99 Content
$('.dummy-content[data-fill]').each(function (index, element) {
var $element = $(element);
var fill = $element.data('fill');
for (var i = 0; i < fill; i++) {
$element.append('<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus congue porta felis non fringilla. Etiam nisl turpis, volutpat ut ipsum id, semper ornare velit. Aliquam non lectus rhoncus, laoreet nisl eget, elementum nisi. Nullam diam ligula, faucibus quis orci rhoncus, blandit facilisis odio. Curabitur iaculis convallis felis ut iaculis. Etiam ut orci ullamcorper ligula elementum elementum vel at odio. Pellentesque feugiat lorem leo, non interdum nisl tristique nec. Suspendisse iaculis urna non convallis.</p>');
}
if ($element.is('[data-fin]')) {
$element.append('<p><a href="http://cdn.ebaumsworld.com/mediaFiles/picture/664379/80470643.gif">Fin</a></p>');
}
});
@jehoshua02
jehoshua02 / xcrun_simctl_list.md
Created October 14, 2014 15:39
Output from `xcrun simctl list`
$ xcrun simctl list
== Device Types ==
iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
iPhone 5 (com.apple.CoreSimulator.SimDeviceType.iPhone-5)
iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
iPhone 6 Plus (com.apple.CoreSimulator.SimDeviceType.iPhone-6-Plus)
iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
iPad 2 (com.apple.CoreSimulator.SimDeviceType.iPad-2)
iPad Retina (com.apple.CoreSimulator.SimDeviceType.iPad-Retina)
@jehoshua02
jehoshua02 / sass_folders.md
Created November 14, 2014 00:19
Sass folder structure
  • scss
    • settings
      • colors.scss
      • variables.scss
    • tools
      • mixins.scss
      • functions.scss
    • generics
      • normalize.scss
  • box-sizing.scss
@jehoshua02
jehoshua02 / Preferences.sublime-settings
Last active August 29, 2015 14:09
My Sublime Config.
{
"binary_file_patterns": [
"bower_components/*",
"node_modules/*",
"build/*",
"dist/*"
],
"color_scheme": "Packages/User/Github.tmTheme",
"default_font_size": 12.0,
"detect_indentation": true,
@jehoshua02
jehoshua02 / svg-loader.md
Last active August 29, 2015 14:10
Dreamcode for webpack svg-loader.

The webpack way to load svg?

Every time I use svg images, I want to provide png fallbacks. I was looking into using the file-loader, but I need to do a bit more:

  • Move svg and png fallback files into the destination folder.
  • Bundle a module for the client to check for svg support.
  • Bundle a module for the client that returns the correct url for the image based on svg support.

I hoped there would be an svg-loader but didn't find one in the list. Maybe it's a good idea?

@jehoshua02
jehoshua02 / note_block.md
Last active August 29, 2015 14:10
Trying to figure out different ways to make a block stand out in a Github markdown page.

Make a Block Stand Out

Vanilla Markdown

NOTE: This is still a v0 project and anything can change. If there is any wiggle room in the version number saved to your bower.json this could cause breakage when installing in a new environment. Either lock in on a version or embrace spontaneous change.