Skip to content

Instantly share code, notes, and snippets.

View dan-ste's full-sized avatar

Daniel Steshenko dan-ste

View GitHub Profile
@dan-ste
dan-ste / fix_footer
Last active October 10, 2015 17:13 — forked from kovaldn/main.css
CSS: footer
@dan-ste
dan-ste / front-end-curriculum.md
Created November 3, 2015 11:04 — forked from stevekinney/front-end-curriculum.md
Front-end Curriculum Draft

Module 1

  • Semantic markup
  • HTML standards mode and quirks mode
  • HTML fundamentals
    • Classes and IDs
  • CSS fundamentals
    • Selectors
    • Resets and normalizers
    • The box model
@dan-ste
dan-ste / smooth_scrolling.js
Created November 17, 2015 14:01
Smooth scrolling after click on anchor with href="#"
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
@dan-ste
dan-ste / inputTypeNumberPolyfill.js
Created November 24, 2016 10:54 — forked from nbouvrette/inputTypeNumberPolyfill.js
Stand alone JavaScript polyfill allow only numbers on input of type number.
/**
* Stand alone polyfill allow only numbers on input of type number.
*
* While input filtering is already supported by default by some browsers, maximum length has not been implemented by
* any. This script will solve both issue and make sure that only digits can be entered in input elements of type
* number. If the optional attribute `max` is set, it will calculate it's length and mimic the `maxlength` behavior on
* input of type text.
*
* Supports:
*
export default TutorialComponent.extend({
result: null,
actions: {
findStores() {
let geolocation = this.get('geolocation');
let store = this.get('store');
geolocation.getCoords()
.then(coords => store.getNearbyStores(coords))
.then(result => {
@dan-ste
dan-ste / bare-minimum.hbs
Created July 6, 2017 07:35
Bare-minimum
<button onclick={{action 'findStores'}}>
Find Nearby Stores
</button>
{{#if result}}
{{#each result.stores as |s|}}
<li>
<strong>{{s.name}}</strong>:
{{s.distance}} miles away
</li>
@dan-ste
dan-ste / production-ready.js
Created July 6, 2017 07:50
Production ready
export default TutorialComponent.extend({
result: null,
isFindingStores: false,
actions: {
findStores() {
if (this.isFindingStores) { return; }
let geolocation = this.get('geolocation');
let store = this.get('store');
export default TutorialComponent.extend({
result: null,
isFindingStores: false, // Add a Loading Spinner
actions: {
findStores() {
if (this.isFindingStores) { return; } // Preventing Concurrency
let geolocation = this.get('geolocation');
let store = this.get('store');
<button onclick={{perform findStores}}>
Find Nearby Stores
{{#if findStores.isRunning}}
{{! ++ }}
{{fa-icon "spinner" spin=true}}
{{/if}}
</button>
{{#if result}}
{{#each result.stores as |s|}}
import { task } from 'ember-concurrency';
export default TutorialComponent.extend({
result: null,
findStores: task(function * () {
let geolocation = this.get('geolocation');
let store = this.get('store');
let coords = yield geolocation.getCoords();