Skip to content

Instantly share code, notes, and snippets.

View chibaye's full-sized avatar

chibaye chibaye

View GitHub Profile
@chibaye
chibaye / DotsLoaders.kt
Created September 3, 2021 11:17 — forked from EugeneTheDev/DotsLoaders.kt
Dots loading animations with Jetpack Compose
import androidx.compose.animation.core.*
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@chibaye
chibaye / SwipeToDelete.kt
Created August 25, 2021 04:30 — forked from bmc08gt/SwipeToDelete.kt
Jetpack Compose Modifier extension to implement swipe-to-delete via Modifier.draggable
import androidx.animation.IntToVectorConverter
import androidx.animation.tween
import androidx.compose.Composable
import androidx.compose.mutableStateOf
import androidx.compose.remember
import androidx.ui.animation.animatedFloat
import androidx.ui.animation.animatedValue
import androidx.ui.core.*
import androidx.ui.core.gesture.scrollorientationlocking.Orientation
import androidx.ui.foundation.animation.FlingConfig
package com.navigine.navigine;
import android.content.Context;
import android.content.res.TypedArray;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
@chibaye
chibaye / SCSS.md
Created July 25, 2021 09:31 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@chibaye
chibaye / README.md
Created July 24, 2021 04:52 — forked from kmassada/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-available directory.
mkdir -p /usr/local/etc/nginx/sites-available

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default and default-ssl to /usr/local/etc/nginx/sites-available
    #STOP APACHE
    sudo apachectl stop
@chibaye
chibaye / app.js
Created July 23, 2021 16:43 — forked from gitboo/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./permission"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
@chibaye
chibaye / README.md
Created July 23, 2021 06:06 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
/**
* Using a single integer to represent multiple permissions
* based on binary values using bitwise operators
*
* & bitwise AND - if both the top and bottom bit are 1, result is 1
* | bitwise OR - if either the top and bottom bit or both are 1, result is 1
* ^ bitwise XOR - if only one of the bits are 1, result is 1
* 0101
* 0100 & = 0100
*
@chibaye
chibaye / .gitignore
Created June 23, 2021 15:22 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png
@chibaye
chibaye / use-location.js
Created June 17, 2021 16:24 — forked from lenkan/use-location.js
React hook that keeps up to date with the current location.
// @ts-check
import { useState, useEffect } from 'react'
function getCurrentLocation () {
return {
pathname: window.location.pathname,
search: window.location.search
}
}