Skip to content

Instantly share code, notes, and snippets.

View opensourcekam's full-sized avatar
🎯
Focusing

✨OSKAM✨ opensourcekam

🎯
Focusing
View GitHub Profile
@nirzaq
nirzaq / server.js
Created March 8, 2018 04:11
Cache API Call and Cache rendered pages in Next.js
const express = require("express");
const cors = require("cors")
const { join } = require("path");
const { parse } = require("url");
const next = require("next");
const fetch = require("isomorphic-unfetch")
const LRUCache = require('lru-cache')
const port = parseInt(process.env.PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== "production";
@nirzaq
nirzaq / next.config.js
Created March 8, 2018 01:35
Next JS SWPrecache Config
const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin')
module.exports = {
webpack: (config) => {
config.plugins.push(
new SWPrecacheWebpackPlugin({
verbose: true,
staticFileGlobsIgnorePatterns: [/\.next\//],
runtimeCaching: [
{
@Lwdthe1
Lwdthe1 / usaCities.js
Last active June 13, 2024 12:53
JSON of 5,950+ USA Cities and Their States - Presented by https://www.ManyStories.com
[
{'city': 'Abbeville', 'state': 'Louisiana'},
{'city': 'Aberdeen', 'state': 'Maryland'},
{'city': 'Aberdeen', 'state': 'Mississippi'},
{'city': 'Aberdeen', 'state': 'South Dakota'},
{'city': 'Aberdeen', 'state': 'Washington'},
{'city': 'Abilene', 'state': 'Texas'},
{'city': 'Abilene', 'state': 'Kansas'},
@softpunch
softpunch / colorVars.css
Last active June 14, 2022 06:44
CSS Variables For Color Manipulation
/* ----
css custom properties to manipulate color
MIT - 2017 - Soft Punch
https://gist.github.com/softpunch/
set initial "main" color via HSL values.
automatically calculate harmonies and variations of that color with pure css.
harmonies are determined solely by hue.

List exif informations

# -s : Short output format
exiftool file.jpg -s
exiftool file.jpg -AllDates
exiftool file.jpg  -FileModifyDate
exiftool file.jpg -DateTimeOriginal
exiftool 20170411_220635.JPG -s | grep Date

exiftool -p "$DateTimeOriginal" "Photo - 01.JPG"
@kevinhillinger
kevinhillinger / function.cs
Last active September 6, 2018 21:20
Azure Functions - Azure Blob Storage - Streaming block blobs
// generic use of SDK
var account = new CloudStorageAccount(credentials, true);
var client = new CloudBlobClient(account.BlobEndpoint.AbsoluteUri, account.Credentials);
var container = client.GetContainerReference("test");
var blob = container.GetBlobReference("CloudBlob.txt");
using (var stream = blob.OpenRead())
{
using (var reader = new StreamReader(stream))
{
@wojteklu
wojteklu / clean_code.md
Last active July 18, 2024 19:11
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@huntie
huntie / dsa-query-selector.js
Last active January 3, 2022 02:14
A simplified implementation of `document.querySelector()` and `document.querySelectorAll()`, during a workshop on data structures.
/**
* Run a callback over all children of a given element using depth-first
* traversal.
*
* @param {HTMLElement} element
* @param {Function} callback
*/
function iterateDOM(element, callback) {
const nodes = [];
@adamjgrant
adamjgrant / about.md
Last active March 22, 2016 16:19
Scoped components is a pattern to group css classes and ids into "Components" which identify high-level units of visual organization in the application.

Scoped components

CSS class names quickly get out of hand. Repos end up with unorganized CSS files all over the place making it difficult to name things and find them in the code.

The scoped components pattern addresses this by grouping classes into "component" scopes.

<div data-component="news-menu">
  <h1 class="title">...</h1>
  <ul class="items">

...

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs