Skip to content

Instantly share code, notes, and snippets.

@cyk
cyk / components.table-legacy.js
Last active Sep 21, 2018
etl-et2-resize-col-constraints
View components.table-legacy.js
import Ember from 'ember';
import EmberTableLegacyComponent from '../../ember-table-legacy/components/ember-table-legacy';
export default EmberTableLegacyComponent.extend({
});
@cyk
cyk / browerstack.js
Last active Jul 2, 2017
Testem BrowserStack Launcher Travis CI
View browerstack.js
// .travis/browserstack.js
#!/usr/bin/env node
const browserstack = require('browserstack');
let WORKER_ID = 0;
let username = process.env.BROWSERSTACK_USER;
let password = process.env.BROWSERSTACK_ACCESS_KEY;
// The exports from BrowserStack Travis addon we're relying on adds
@cyk
cyk / README.md
Last active Jul 28, 2020
Face Sentiments with Google Vision API via AWS API Gateway and Lambda
View README.md

Face Sentiments with Google Vision API via AWS API Gateway and Lambda

My notes (and rudimentary guide) from a research spike that delved into the Google Vision API, AWS API Gateway and Lambda, prototyping a "serverless" API endpoint that returns sentiments expressed by faces in an image.

Introduction

Google's been rockin' their cloud offerings hard lately. Among their latest releases is the Cloud Vision API (in beta), a service that analyzes the content of an image; detecting things like words, phrases, objects, faces and their emotions. Let's prototype a "serverless" face sentiments endpoint using only the Vision API, AWS API Gateway and a Lambda function.

A quick note on Cloud Vision API pricing. As of this writing, the free tier for face detection is <1000/mo. This app can easily exceed this limit. To give you an idea of this, so far I've used 1103 face detection operations

@cyk
cyk / ember-data.dependent-relations.js
Last active Dec 12, 2020 — forked from slindberg/ember-data.dependent-relations.js
Dependent Relationships in Ember Data (for Ember Data v1.13.x)
View ember-data.dependent-relations.js
/**
Ember Data: Dependent Relationships (Ember Data v1.13.x)
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),
@cyk
cyk / wait-for-change.js
Last active Aug 29, 2017
Ember Test Helper: Wait for Change (via MutationObserver)
View wait-for-change.js
/**
Ember Test Helper: Wait for Change
Using the MutationObserver API, this helper will wait for an element's contents
to change prior to progressing forward. This is helpful when you are testing
interactions involving async components (ex., Google Maps SDK queries).
@link https://gist.github.com/cyk/e3828d18b26562091447
```javascript
@cyk
cyk / keybase.md
Created May 26, 2015
Keybase proof
View keybase.md

Keybase proof

I hereby claim:

  • I am cyk on github.
  • I am cyk (https://keybase.io/cyk) on keybase.
  • I have a public key whose fingerprint is 00CB 31E6 50DE 8EE8 B228 97EC B892 68C4 DA72 1418

To claim this, I am signing this object:

@cyk
cyk / chunk_by_element_length.php
Created Apr 8, 2014
chunk_by_element_length.php
View chunk_by_element_length.php
<?php
/**
* Chunk by (combined) Element Length
*
* Similar to PHP's array_chunk but chunks on combined element length instead of element count.
* Takes an input array of elements and chunks by combined string lengths.
*
* NOTE: Any values that exceed chunk length will be excluded.
*
@cyk
cyk / EntityManagerMigration.php
Created Apr 8, 2014
EntityManagerMigration.php
View EntityManagerMigration.php
<?php
namespace MyApp\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**