Skip to content

Instantly share code, notes, and snippets.

@davidanton1d
davidanton1d / show-above-the-fold.js
Created October 30, 2018 10:38
Move a div to "above the fold" if not visible at load. Div follows scroll until resting in original position.
var originalPosition = false;
(function(){
var $ = jQuery;
function updateSliderSizeAndOrigPos(){
setTimeout(function(){
$("#interest-form__wrap").css('top', 0 + 'px')
originalPosition = $("#interest-form__wrap").offset().top
updateSliderSize()
@davidanton1d
davidanton1d / keybindings-mac.json
Last active February 10, 2017 06:20
Sublime key bindings
[
{ "keys": ["ctrl+shift+o"], "command": "prompt_open_folder" },
{ "keys": ["ctrl+tab"], "command": "next_view" },
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["ctrl+pagedown"], "command": "next_view_in_stack" },
{ "keys": ["ctrl+pageup"], "command": "prev_view_in_stack" },
@davidanton1d
davidanton1d / web.config
Last active January 24, 2017 11:46
Wordpress on IIS - rewrite rules
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_URI}" matchType="Pattern" pattern="^/wp-content/" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
//Bakground video loop on ios through canvas
//Note that jQuery is supposed to be loaded as $j due to non-conflict in the original place
/// START VIDEO HANDLING FOR MOBILE
/// START VIDEO HANDLING FOR MOBILE
/// START VIDEO HANDLING FOR MOBILE
var cvpHandlers = {
canvasClickHandler: null,
@davidanton1d
davidanton1d / One line.js
Last active August 29, 2015 14:16
One-liner ugly jQuery sticky footer
// Sticky footer
$(document).ready(function adjustFooterMargin(){$("#footer").css("margin-top", Math.max(0, $(window).height() -$("#top").height() -$("#wrapper").height() -$("#footer").height() -50) + "px"); }); $(window).resize(function(){adjustFooterMargin(); });
@davidanton1d
davidanton1d / Spritz-clone-v.2.markdown
Created August 22, 2014 07:04
A Pen by David Forsberg.

Spritz clone v.2

Thought it would be a fun challenge to build something like the Spritz service. Skipped the science part and hacked away, and the result is pretty decent! It measures each character, and then calculates a visual centerpoint (slightly off to the left). Would be nice to rebuild this into a bookmarklet. (Feel free to fork it!)

A Pen by David Forsberg on CodePen.

License.