Skip to content

Instantly share code, notes, and snippets.

View koca's full-sized avatar

Mesut Koca koca

View GitHub Profile
@stursby
stursby / README.md
Last active September 8, 2024 11:22
Vue + Firebase + Auth Demo

Vue + Firebase + Auth Demo

A simple App using Vue.js & Firebase with Auth.

See the DEMO.

@sarahdayan
sarahdayan / modifiers.scss
Last active November 15, 2024 15:56
Sass Modifiers Mixin
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
// Sass modifiers mixin by Sarah Dayan
// Generate All Your Utility Classes with Sass Maps: frontstuff.io/generate-all-your-utility-classes-with-sass-maps
// http://frontstuff.io
// https://github.com/sarahdayan
@mattbrailsford
mattbrailsford / .travis.yml
Last active September 12, 2021 13:49
Configuration for deploying a NUXT static site to github pages
language: node_js
node_js:
- "8"
cache:
directories:
- "node_modules"
branches:
only:
#!/usr/bin/env bash
echo "Starting bootstrapping"
# Check for Homebrew, install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
@vincentriemer
vincentriemer / SafeAreaInsets.js
Last active September 9, 2019 16:10
"Safe Area Inset" value tracking (most immediately useful with iPhone X) via React context & hooks.
/**
* @flow
*/
import * as React from "react";
type SafeAreaInsetsContextType = $ReadOnly<{|
top: number,
left: number,
right: number,
@pitpit
pitpit / README.md
Last active August 25, 2019 21:14
Lazy loading with angularjs, ui-router, webpack and typescript
@vincentriemer
vincentriemer / usePersistedState.js
Created August 6, 2019 15:06
My take on a type-safe usePersistedState hook, leveraging React suspense/concurrent-mode, DOM custom events, and the kv-storage builtin module.
/**
* @flow
*/
import * as React from "react";
import { unstable_createResource } from "react-cache";
import * as Scheduler from "scheduler";
import { StorageArea } from "std:kv-storage";
// Creates a ref that tracks the latest value of the argument passed to it
@souporserious
souporserious / use-measure-example.jsx
Last active February 29, 2020 15:23
use-measure hook for collecting component measurements
// Handle outside and local measurements easily
function Singular({ ref, value }) {
const [width, setWidth] = useState(-1)
const [useMeasureRef, useMeasureEffect] = useMeasure()
useMeasureRef(ref)
useMeasureEffect(
([node]) => {
setWidth(node.offsetWidth)
},
[value]
import * as React from "react";
import { useMousePosition } from "~/hooks/useMousePosition";
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) {
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {};
const [mouseX, mouseY] = useMousePosition();
const positions = { x, y, h, w, mouseX, mouseY };
return (
<div
function partition(inputArray, callback) {
const result = {};
for (const [indexOfValue, value] of inputArray.entries()) {
const propertyKey = callback(value, indexOfValue);
if (propertyKey === null || propertyKey === '') {
continue;
}
if (!{}.hasOwnProperty.call(result, propertyKey)) {
result[propertyKey] = [];
}