Skip to content

Instantly share code, notes, and snippets.

@james2doyle
james2doyle / keyup-debouce-timeout.js
Created October 5, 2016 19:29
A debounce timeout trigger for typing in an input. The example is in jQuery, but this works with any event/listener.
$('#input').on('keyup', function() {
// do an ajax save when this input is changed
var val = this.value;
// clear the timeout so we dont fire in succession
clearTimeout(this.delayer);
this.delayer = setTimeout(function () {
console.log(val);
}, 500);
});
@Kikobeats
Kikobeats / index.js
Last active July 10, 2023 16:21
ES6 Pure & self documented Functions.
/**
* ES6 Pure & self documented Functions.
*
* Why Pure?
*
* A pure function is a function where the return value is only determined
* by its input values, without observable side effects.
*
* Why Self-documented?
*
@MattMcFarland
MattMcFarland / styles.less
Created July 15, 2016 17:00
Ligature fonts for atom
atom-text-editor {
font-family: 'Fira Code';
font-style: normal;
text-rendering: optimizeLegibility;
}
atom-text-editor::shadow {
.string.quoted,
.string.regexp {
-webkit-font-feature-settings: "liga" off, "calt" off;
}
@robinrendle
robinrendle / browsersync-webpack.md
Last active February 27, 2024 12:04
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.

@carolina-vallejo
carolina-vallejo / lock-unlock-scroll.js
Last active August 27, 2016 17:44
lock/unlock scroll
function lock_scroll(){
// lock scroll position, but retain settings for later
var scrollPosition = [
self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
];
var html = jQuery('html'); // it would make more sense to apply this to body, but IE7 won't have that
html.data('scroll-position', scrollPosition);
html.data('previous-overflow', html.css('overflow'));
html.css('overflow', 'hidden');
@dtomasi
dtomasi / default
Last active December 8, 2023 04:20
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
<html>
<head>
<style>
.item {width:300px; display: inline-block; }
.item .itemtitle {font-weight:bold; font-size:2em;}
.hidden {display:none;}
</style>
</head>
<body>
<h1>Amalgam Comics Characters</h1>
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active April 22, 2024 17:49
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@bivainis
bivainis / sanfrancisco-font.css
Last active April 18, 2019 02:52
San Francisco Web Font
/**
* http://applemusic.tumblr.com/
*/
/** Ultra Light */
@font-face {
font-family: "San Francisco";
font-weight: 100;
src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-ultralight-webfont.woff2");
}