Skip to content

Instantly share code, notes, and snippets.

View ducksoupdev's full-sized avatar

Matt Levy ducksoupdev

View GitHub Profile
@ducksoupdev
ducksoupdev / RSACryptoService.cs
Created July 24, 2018 08:59 — forked from beginor/RSACryptoService.cs
C# RSACryptoService with openssl rsa key
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace CMCloud.SaaS
{
@ducksoupdev
ducksoupdev / README.md
Created July 19, 2018 10:54 — forked from hsablonniere/README.md
scrollIntoViewIfNeeded 4 everyone!!!

scrollIntoViewIfNeeded 4 everyone!!!

This gist provides a simple JavaScript implementation of the non-standard WebKit method scrollIntoViewIfNeeded that can be called on DOM elements.

Usage

Just use the code in index.js in your app or website. You can see usage in the test page test.html.

The parent element will only scroll if the element being called is out of the view. The boolean can force the element to be centered in the scrolling area.

@ducksoupdev
ducksoupdev / readme.md
Created May 22, 2018 11:52 — forked from FrikkieSnyman/readme.md
GrapesJS - attributes, classes, and scripts

GrapesJS - attributes, classes, and scripts

Attributes

In order to add custom attributes to an HTML element that is generated by GrapesJS, one can simply make use of traits. For example, if you wish to produce an HTML element which contains the tag data-noout, a trait with the name data-noout can be added to a custom component.

    var domComps = editor.DomComponents;
    var dType = domComps.getType('default');
 var dModel = dType.model;
@ducksoupdev
ducksoupdev / workbox.md
Created March 28, 2018 18:26 — forked from addyosmani/workbox.md
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()
@ducksoupdev
ducksoupdev / gist:a746d7ef188dd6866256443e68692dfb
Created January 17, 2018 08:57 — forked from tkihira/gist:3014700
mkdir, rmdir and copyDir(deep-copy a directory) in node.js
var mkdir = function(dir) {
// making directory without exception if exists
try {
fs.mkdirSync(dir, 0755);
} catch(e) {
if(e.code != "EEXIST") {
throw e;
}
}
};
@ducksoupdev
ducksoupdev / Vagrantfile
Created January 12, 2018 20:18 — forked from mcharytoniuk/Vagrantfile
Vagrant + docker-compose
Vagrant.configure(2) do |config|
config.vm.box = "phusion/ubuntu-14.04-amd64"
config.vm.network "forwarded_port", guest: 3306, host: 3306
# If errors occur, try running "vagrant provision" manually
# after "vagrant up"
config.vm.provision :docker
# To use docker_compose as a provisioning tool, install
# vagrant-docker-compose plugin first. It should also solve the
@ducksoupdev
ducksoupdev / package.json
Created September 19, 2017 12:12
Bundle SVG with NPM
{
"bundle-svg": "svg-sprite --symbol --svg-xmldecl=false --svg-doctype=false --symbol-dest=. --symbol-sprite=edit.bundle.svg --symbol-inline=true --dest=src/img src/img/inline-svg/*.svg",
}
@ducksoupdev
ducksoupdev / jsx.d.ts
Created September 14, 2017 13:00 — forked from foxbunny/jsx.d.ts
JSX definition for Vue.js
// I'm not the original author of this code. Please let me
// know if you know/find the original author so I can fully
// attribute.
import Vue, { VNode } from "vue";
declare global {
namespace JSX {
interface Element extends VNode {}
interface ElementClass extends Vue {}
@ducksoupdev
ducksoupdev / hmr-index.js
Created August 17, 2017 07:16 — forked from remy/hmr-index.js
A take on HMR. I don't remember exactly where it came from, but it works for me.
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import store from './store';
const rootEl = document.getElementById('root');
// Create a reusable render method that we can call more than once
let render = () => {
// Dynamically import our main App component, and render it
@ducksoupdev
ducksoupdev / keybindings.json
Created March 2, 2017 08:50
VSCode keybindings
[
{
"key": "ctrl+shift+/",
"command": "editor.action.blockComment",
"when": "editorTextFocus"
},
{
"key": "ctrl+s",
"command": "workbench.action.tasks.build",
"when": "editorLangId == 'typescript'"