Skip to content

Instantly share code, notes, and snippets.

@mixin for-phone-only {
@media (max-width: 599px) { @content; }
}
@mixin for-tablet-portrait-up {
@media (min-width: 600px) { @content; }
}
@mixin for-tablet-landscape-up {
@media (min-width: 900px) { @content; }
}
@mixin for-desktop-up {
@nkhil
nkhil / arrow.js
Created October 1, 2018 20:39
Lexical Scope of Arrow Functions
const something = ()=>{
console.log(this
}
@nkhil
nkhil / package.json
Created October 3, 2018 07:48 — forked from addyosmani/package.json
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
const endpoint = 'https://www.gov.uk/bank-holidays.json';
const ul = document.getElementById('holidays')
let bankHolidays;
let england;
fetch(endpoint)
.then(blob => blob.json())
.then(data => handleDates(data));
function handleDates(data) {
bankHolidays = data;
@nkhil
nkhil / gist:c1a87c28bf44da7ec77fb1e2a33907a2
Created November 2, 2018 20:22 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
rm -rf node_modules && npm install
//ERROR:
//ReferenceError: internalBinding is not defined at fs.js:25:1
// SOLUTION:
// When you update node you need to run rm -rf node_modules && npm install
//to rebuild/reinstall your native modules against your new node version.
const order = [
{
width: 8,
height: 9,
depth: 7,
},
{
width: 18,
height: 29,
depth: 37,
class Parcel {
constructor(dimensions) {
this.dimensions = dimensions;
this.parcelSize = Parcel.returnParcelSize(dimensions);
this.price = Parcel.calculatePrice(dimensions);
}
static get prices() {
return {
@nkhil
nkhil / random.js
Created September 12, 2019 13:40
Pick out a random number of items out of an array
const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
a.sort(() => .5 - Math.random() ).slice(0, 4);
//=> [3, 1, 6, 5]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import glob
import time
import argparse
from inky import InkyPHAT
from PIL import Image, ImageDraw, ImageFont
from font_fredoka_one import FredokaOne