Skip to content

Instantly share code, notes, and snippets.

View scottwernervt's full-sized avatar

Scott Werner scottwernervt

View GitHub Profile
"""
Non blocking example:
1. Browse to `localhost:8000/sleep1`
2. Browse to `localhost:8000/`
You'll observe that the first call will take 5 seconds and the second call will be executed immediately.
Blocking example:
1. Browse to `localhost:8000/sleep2`
2. Browse to `localhost:8000/`
@scottwernervt
scottwernervt / remove-advertisers.js
Created May 1, 2019 01:14 — forked from bluetidepro/remove-advertisers.js
Auto click "remove" on all facebook advertisers
// I did this in Chrome...
//
// Go to https://www.facebook.com/ads/preferences/
// Click the "Advertisers" section to open it up.
// Click "See more" once
// Before doing anything else, just keep clicking space bar to trigger the "see more" button
// Do this for a bit until all the advertisers are loaded
// then run this below in the dev tools console...
// (It will take a few minutes, depending how many you have, and your browser may lock up, but once it's done you will see it auto clicked the "remove" X in the top right for all of them)
@scottwernervt
scottwernervt / controllers.application.js
Last active December 11, 2018 16:08
ember-notifier
import Ember from 'ember';
import { inject as service } from '@ember/service';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
notifier: service(),
actions: {
launch() {
const options = { duration: 0 };
@scottwernervt
scottwernervt / adapters.application.js
Last active September 21, 2018 13:51 — forked from samselikoff/mirage.config.js
MS with Ember nice URL slugs and link to helper
import DS from 'ember-data';
export default DS.JSONAPIAdapter.extend({
namespace: 'api'
});
@scottwernervt
scottwernervt / adapters.application.js
Created May 24, 2017 20:38 — forked from openhouse/adapters.application.js
ember-infinity+ember-group-by
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
shouldBackgroundReloadRecord() { return false; }
});
@scottwernervt
scottwernervt / controllers.application.js
Last active September 25, 2018 18:22
ember-cli-group-by demo
import Ember from 'ember';
import { groupByPath } from 'ember-cli-group-by/macros';
const {
computed: { alias },
} = Ember;
export default Ember.Controller.extend({
user: alias('model'),
cart: alias('user.cart'),
@scottwernervt
scottwernervt / controllers.application.js
Last active May 17, 2017 21:04
group-by helper issue with promises
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
data: [
{ label: 'language', name: 'Python' },
{ label: 'language', name: 'JavaScript' },
{ label: 'web', name: 'Django' },
{ label: 'web', name: 'Flask' },
@scottwernervt
scottwernervt / components.type-select.js
Last active March 3, 2017 03:17
ember-data-change-tracker: Belongs to relationship is always null even though ID is present #8
import Ember from 'ember';
export default Ember.Component.extend({
store: Ember.inject.service(),
selected: null,
types: [],
loadTypes: Ember.on('didInsertElement', function () {
this.get('store').findAll('type')
@scottwernervt
scottwernervt / controllers.application.js
Last active May 20, 2017 21:53
emberx-select: Doesn't work with RSVP hash #180
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@scottwernervt
scottwernervt / controllers.application.js
Last active July 29, 2016 15:05 — forked from initram/controllers.application.js
aupac-typeahead - bug - allowFreeInput=true fires action when clicking off input
import Ember from 'ember';
const skills = ['Python', 'Javascript', 'Django']
export default Ember.Controller.extend({
skill: null,
skillSource: function(query, syncResults, asyncResults) {
const regex = new RegExp('.*' + query + '.*', 'i');
const results = skills.filter((item, index, enumerable) => {
return regex.test(item);