Skip to content

Instantly share code, notes, and snippets.

View devotox's full-sized avatar
💻
Innovating

Devonte devotox

💻
Innovating
View GitHub Profile
{
"label": "Subform Top",
"sections": [
{
"label": "Subform Top",
"fields": [
{
"id": "121",
"type": "text",
"required": true,
import Ember from 'ember';
import fetch from 'fetch';
const { FormData } = window;
import { debug } from '@ember/debug';
import Service, { inject } from '@ember/service';
@devotox
devotox / ember-sandbox-service.js
Last active October 18, 2022 07:46
Create A Javascript sandbox to execute custom code without giving access to things like window and outer contextThey still have a `this` object they can use across multiple executions to persist data
import Service from '@ember/service';
const has = () => true;
const { console, WeakMap, Proxy, Symbol } = window;
const get = (target, key) => key === Symbol.unscopables ? undefined : target[key];
export default Service.extend({
@devotox
devotox / s3-optimize-images.js
Last active January 21, 2021 00:09
Run Through S3 Images (JPEG) and optimize them using imagemin and reupload to same path - Automatically sets the cache control to a day and public
#!/usr/bin/node
const fs = require('fs');
const path = require('path');
const AWS = require('aws-sdk');
const Promise = require('bluebird');
const imagemin = require('imagemin');
const imageminJpegRecompress = require('imagemin-jpeg-recompress');
const config = {
@devotox
devotox / fastboot-on-visit
Created September 14, 2017 01:42
Ember Fastboot onVisit Middleware
// ember-cli-fastboot/index.js
let fastbootMiddleware = FastBootExpressMiddleware({
+ onVisit: fastbootConfig.onVisit,
fastboot: this.fastboot
});
// fastboot-express-middleware/src/index.js
function fastbootExpressMiddleware(distPath, options) {
return function(req, res, next) {
@devotox
devotox / README.md
Last active June 5, 2021 06:36
Ember Engines With Ember Simple Auth

Using Ember Simple Auth with Ember Engines (In Repo Engine)

  • This shows the steps needed to get Ember Simple Auth to work with Ember Engines as if they are the same application

  • Things to note

    • engine login page needs to transitionToExternal('login')
    • login has to be passed in as an external route to the engine
    • session and cookie services both need to be passed into engine
    • sessionAuthenticated function needs to be overwritten in the Application Controller of the Engine
  • in /app/app.js add to const engines object { [Engine Name]: dependencies }

Keybase proof

I hereby claim:

  • I am devotox on github.
  • I am dtox (https://keybase.io/dtox) on keybase.
  • I have a public key ASAF403OlS8hip1EaVEIyBGOASW6pkgX6hW7PYYjpPFmsgo

To claim this, I am signing this object:

@devotox
devotox / adapters.application.js
Created July 13, 2016 07:55 — forked from pangratz/adapters.application.js
findRecord with slug support
import Adapter from "ember-data/adapters/json-api";
export default Adapter.extend({
urlForQueryRecord({ slug }, modelName) {
if (slug) {
return this.urlForFindRecord(slug, modelName);
}
return this._super(...arguments);
@devotox
devotox / build_nginx.sh
Last active January 31, 2016 22:48 — forked from MattWilcox/build_nginx.sh
Fetch, build, and install the latest nginx with the latest OpenSSL for RaspberryPi
#!/usr/bin/env bash
# names of latest versions of each package
export VERSION_PCRE=pcre-8.38
export VERSION_OPENSSL=openssl-1.0.2f
export VERSION_NGINX=nginx-1.9.10
# URLs to the source directories
export SOURCE_OPENSSL=https://www.openssl.org/source/
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
(function () {
'use strict';
var cluster = require('cluster'),
http = require('http'),
os = require('os'),
ClusterServer,
workers = {};
/*