Skip to content

Instantly share code, notes, and snippets.

View bitflower's full-sized avatar

Matthias Max bitflower

View GitHub Profile
@bitflower
bitflower / example-migration.ts
Last active April 30, 2021 00:00
MongoDB migrations with umzug in a FeathersJS application
import { Service } from '@feathersjs/feathers';
import { App } from '../src/app.interface';
import { Transformation } from '../src/services/transformations/transformations.interface';
export default {
up: async (app: App): Promise<boolean> => {
// Get service
const s: Service<Transformation> = app.service('transformations');
@bitflower
bitflower / package.json
Last active April 23, 2020 19:09
StencilJS dependency watch in a monorepo
// packages/ui/package.json
{
....
"scripts": {
"dev": "npm run watch-dev | npm run dev-stencil",
"dev-stencil": "npm run dev-mode && npm run co-prebuild && stencil build --dev --watch --serve",
"watch-dev": "node ./build/dev-watch.js"
},
@bitflower
bitflower / co-file-storage.class.ts
Created March 4, 2020 12:54
Debouncedd Capacitor Storage for redux-persist
import {
FileDeleteResult,
FileReadResult,
FilesystemDirectory,
FileWriteOptions,
FileWriteResult,
Plugins,
ReaddirResult
} from '@capacitor/core';
import { getLogger, loggableObject, makeDebounce } from '@case-os/commons';
@bitflower
bitflower / animate-component.tsx
Created October 28, 2019 07:32 — forked from jdnichollsc/animatable-component.html
Animatable Components using Higher Order Component (HOC) with StencilJS 🙌
import { Component, h, Element, Prop, Host, Event, EventEmitter } from '@stencil/core';
@Component({
tag: 'animatable-component'
})
export class AnimatableComponent {
@Element() el!: HTMLElement;
@Prop() keyFrames: Keyframe[]
@Prop() options: KeyframeAnimationOptions
@Event() finish: EventEmitter;
export PATH=/usr/local/bin:$PATH
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
# NVM (Node version manager)
export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
. "$(brew --prefix nvm)/nvm.sh"
# JAVA / ANDROID
#export ANDROID_HOME=/usr/local/opt/android-sdk
@bitflower
bitflower / .bash_profile
Created January 23, 2018 11:02 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@bitflower
bitflower / ion-radio-fix.sass
Created October 11, 2015 18:51
ionRadio fix for iOS 9 bugs (SASS version)
/**
* This CSS uses adjacent selectors instead of general sibling (~) selectors
* for ion radio that are broken in iOS 9 UIWebView.
*
* To apply the patch, include this CSS after your ionic.css include.
*
* SASS version of Max Lynch's CSS snippet:
* https://gist.github.com/mlynch/064d27912b511a63caa3
*/
@bitflower
bitflower / font_grabber.rb
Last active August 29, 2015 14:25 — forked from ttscoff/font_grabber.rb
Give it a <link> from Google fonts and get back CSS with fonts embedded
#!/usr/bin/ruby
# encoding: utf-8
# Grab google web fonts and embed them as base64 data URIs
# <http://brettterpstra.com/2015/03/14/embedding-google-web-fonts/>
require 'base64'
if ARGV.length > 0
input = ARGV
elsif STDIN.stat.size > 0
input = STDIN.read.strip.split(/\n+/)
@bitflower
bitflower / ngModelOnChange.js
Created July 23, 2015 17:36
ngModelOnChange: bind ngModel if input[type=file] to scope
(function() {
'use strict';
var app = angular.module('net.bitflower.ngModelOnChange', []);
// Listens to the change event of the input and sets Angular's value / ngModel of the element
app.directive('ngModelOnChange', function() {
return {
restrict: 'A',
@bitflower
bitflower / ng-really.js
Last active August 29, 2015 14:24 — forked from asafge/ng-really.js
/**
* A generic confirmation for risky actions.
* Usage: Add attributes: ng-really-message="Are you sure"? ng-really-click="takeAction()" function
*/
angular.module('app').directive('ngReallyClick', [function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
element.bind('click', function() {
var message = attrs.ngReallyMessage;