Skip to content

Instantly share code, notes, and snippets.

@anthonycoffey
anthonycoffey / sass-loading-component.vue
Last active May 9, 2019 05:50
Language attribute set to SCSS in Vue component
<template>
<div>
</div>
</template>
export default {
name: 'sass loading component',
}
</script>
<style lang="scss" scoped>
// we can write sass now, woohoo!
@anthonycoffey
anthonycoffey / webpack.config.js
Created May 9, 2019 05:41
Webpack Config to use SCSS Preloader with Vue
module.exports = {
module: {
rules: [
// ... other rules omitted
// this will apply to both plain `.scss` files
// AND `<style lang="scss">` blocks in `.vue` files
{
test: /\.scss$/,
use: [
@anthonycoffey
anthonycoffey / install-sass-loaders.sh
Created May 9, 2019 05:38
Install sass-loader and node-sass packages
npm install sass-loader node-sass -s
@anthonycoffey
anthonycoffey / average-component.vue
Created May 9, 2019 05:29
Average Vue Component
<template>
<div>
</div>
</template>
export default {
name: 'average component',
}
</script>
<style scoped>
// css goes here
@anthonycoffey
anthonycoffey / javascript-object-destructuring-ex1.js
Created May 7, 2019 13:07
JavaScript Object Destructuring Example 1
var user = { name: 'Bill', age: 31, city: 'Dallas', state: 'TX' }
// object destructuring
var {city, state} = user;
console.log(city, state); // "Dallas", "TX"
@anthonycoffey
anthonycoffey / javascript-object-property-accessors.js
Last active May 30, 2019 23:17
Javascript Object Property Accessors
const obj = { a: 1, b: 4}
// dot operator
obj.a // 1
// bracket notation
obj['b'] // 4
@anthonycoffey
anthonycoffey / template-literals.js
Last active May 30, 2019 23:46
Template Literals and String Interpolation
var welcome = `Welcome!` // Welcome!
var name = 'John Doe'
var greeting = `Hello, ${name}.` // Hello, John Doe.
// you can use more than one variable in a template literal
var month = 5
var day = 30
var year = 2019
@anthonycoffey
anthonycoffey / map-array-with-property-name-as-index.js
Last active January 22, 2019 06:47
jQuery Map array with property name as index
var data = [];
jQuery.map(obj , function (n, i) {
data[n.name] = n.value;
});
@anthonycoffey
anthonycoffey / inset-box-shadow.css
Created December 2, 2018 22:08
Good Inset Box Shadow for a mouseover "pushed in" effect
box-shadow: inset 0px 1px 3px rgba(0,0,0,.5);
@anthonycoffey
anthonycoffey / usage-of-useful-sass-mixin-for-responsive-design.scss
Last active April 30, 2019 00:18
Example of using the useful sass mixin for responsive design
.selector {
// small screens (xsmall - small)
@include breakpoint(small){
// add styling here
}
// medium screens (small - medium)
@include breakpoint(medium){
// add styling here