This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* import Tika into a file with this */ | |
import org.apache.tika.Tika; | |
/* | |
assume the file's content is in a string called 'file' | |
you can detect a file's mime type with the following | |
https://tika.apache.org/1.8/api/org/apache/tika/Tika.html#detect(byte[]) | |
*/ | |
String detectedFileType = (new Tika()).detect(file.getBytes()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
value - the variable to serialize | |
LIMIT - (optional) number of chars to limit nested variables to, obviously breaks deserialize | |
*/ | |
function serialize(value,LIMIT) { | |
switch(typeof value) { | |
case "function": | |
var func = value.toString(); | |
if (func.search(/\[[^,'"`]+\]/g) > -1) { | |
var ROOT; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get csvStr, and pass it to .parse | |
let csv = Papa.parse(csvStr,{ | |
transform: function (value) { | |
try { | |
return JSON.parse(value); | |
} catch(err) { | |
return value; | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hulu Play/Pause | |
// @namespace http://abaganon.com/ | |
// @version 0.1 | |
// @description Add play/pause shorcut to Hulu | |
// @author Eric Fossas | |
// @match https://www.hulu.com/watch/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* import all 3 libraries and file system for writing the final file */ | |
var sass = require('node-sass'); | |
var CleanCSS = require('clean-css'); | |
var uncss = require('uncss'); | |
var fs = require('fs'); | |
/* compile scss files */ | |
// you need to set 'filename' to a string of the path to your main scss file | |
sass.render({file: filename}, function(err, result) { | |
if (err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the FROM instruction sets the original image to start with | |
# namespace/image:tag | |
# without a namespace, the image is must be an official docker image. https://docs.docker.com/docker-hub/official_repos/ | |
# without a tag, 'latest' is the default | |
# so here, we'll use a container with node installed on it, using the Alpine OS, which is very lightweight | |
FROM node:alpine | |
# the RUN instruction runs a command | |
# here we use the apk package manager to install git and other tools | |
RUN apk update && apk upgrade && apk add coreutils git openssl wget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set the version of Docker compose to use | |
# avoiding the minor number just uses the latest version, i.e. 3 -> 3.7 | |
version: '3' | |
# our Docker networks. we create just one: 'proxy' | |
# we set 'proxy' to use the 'bridge' driver, which actually happens by default if that field is omitted | |
# since our containers aren't on the 'host' network, they will be isolated from the host until we do some port mapping/exposing | |
# if you don't define a network, docker compose will create a 'default' network and put all services/containers on it | |
networks: | |
proxy: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# environment variables that start with 'COMPOSE' or 'DOCKER' are for setting docker configuration | |
# https://docs.docker.com/compose/reference/envvars/ | |
# compose uses a project namespace for a 'stack', a collection of services orchestrated by a docker-compose.yml file | |
COMPOSE_PROJECT_NAME=crud | |
# you can set one or multiple compose files (separated by a ':') to use when running docker-compose up | |
COMPOSE_FILE=docker-compose.yml | |
# you can also add environment variables that can be be used in docker-compose.yml files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# enable logging on the debug level | |
logLevel = "DEBUG" | |
# log Traefik related stuff. It defaults to logging to stdout | |
# to view logs, run the command: docker logs traefik | |
[traefikLog] | |
# log requests. It defaults to logging to stdout | |
# the filters are for logging only requests that get certain http status codes, in this case we log everything | |
[accessLog] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NgModule } from '@angular/core'; | |
import { StoreModule } from '@ngrx/store'; | |
@NgModule({ | |
imports: [StoreModule.forRoot({})] | |
}) | |
export class AppModule {} |
OlderNewer