Skip to content

Instantly share code, notes, and snippets.

View rcline's full-sized avatar

Ryan Cline rcline

View GitHub Profile
@rcline
rcline / svelte2angularjs.js
Last active June 13, 2020 02:13
Render templates or DOM elements inside a Svelte component with AngularJS
/**
* svelte2Angularjs
*
* Render templates or DOM elements inside a Svelte component with AngularJS
*
* Usage:
* svelte2Angularjs({ el: ngDom });
* svelte2Angularjs({
* el: ngDom2,
* template: `<span> {{mode === 'recent' ? 'Recent Activity' : 'Feed'}}</span>`,
@rcline
rcline / svelte-shim.js
Last active December 5, 2020 12:22 — forked from dimfeld/svelte-shim.ts
Turn a Svelte component into an AngularJS component
import type { SvelteComponent } from "svelte";
import type { IControllerConstructor, IOnChangesObject } from "angular";
/**
* Turn a Svelte component into an AngularJS component
*
* ## Usage
*
* Create the component boilerplate for use inside AngularJS code:
// app.header.component.ts
import type { IComponentOptions } from 'angular';
/**
* Useage:
* <svelte component="MySvelteComponent" all-props="allPropsFromAngularJS"></svelte>
*
*/
(function() {
'use strict';
angular
.module('myapp')
@rcline
rcline / pre-push
Last active March 7, 2019 19:38
pre-push hook to protect upstream/master
#!/bin/bash
# @link https://gist.github.com/rcline/e010918635d8359a2c1aa83135087797
#
# A hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
@rcline
rcline / github-pr-packages-edited.js
Last active January 3, 2019 21:38
Run on the PRs file view page to get a list of monorepo packages that where edited.
((doc, log) => {
el = doc.getElementsByClassName("link-gray-dark");
pkgs = [];
Object.keys(el).map((c) => {
const split = el[c].innerText.split('/');
if (split[0] == 'packages') {
pkgs.push(
`@sstk/${split[1]}`
)
@rcline
rcline / webpack-stats-hide-bundles.js
Last active December 28, 2018 21:29
Run on the Webpack Bundle Analyzer to remove all the bundle cruft and focus on the app and page bundles.
/**
* You must keep the sidebar open while it is turning off the bundles
* (Window doesn't have to be active but if you mouse hovers over the webpack stats graph it will break.)
*/
// Manually open the sidebar
((win) => {
sideBar = document.querySelectorAll('#app > div > div.Sidebar__container.Sidebar__left > button.Sidebar__toggleButton.Button__button')[0];
sideBar.click();
// Wait for side bar navigation to finish