Skip to content

Instantly share code, notes, and snippets.

View zevisert's full-sized avatar

Zev Isert zevisert

View GitHub Profile
@zevisert
zevisert / post.component.ts
Last active December 12, 2016 22:16
Post Component
@Component({...})
export class PostComponent implements OnInit {
post: Post;
constructor(
@Inject(BlogService) private blogService: BlogService,
@Inject(ActivatedRoute) private activatedRoute: ActivatedRoute
) { }
@zevisert
zevisert / blog.service.ts
Created December 12, 2016 22:18
Blog Service
@Injectable()
export class BlogService {
private allPostsUrl = "api/posts";
private singlePostUrl = "api/post/";
private cachedPosts: PostData[];
private cachedPromise: Promise<PostData[]>;
// Angular2-jwt nicely attaches the token to every request for us
constructor(@Inject(AuthHttp) private http: AuthHttp) { }
@zevisert
zevisert / auth.service.ts
Last active December 12, 2016 22:22
Auth Service
@Injectable()
export class AuthService {
...
validate(pattern: string, route: string): void {
let body: AuthBody = { type: "Anonymous", payload: pattern };
// Fire off a request to the server to see if the pattern entered is valid
this.postAuth(body)
@zevisert
zevisert / Discover-Services-Available.js
Last active February 28, 2017 07:08
Discovering Recollect's API
function test_service(place, i) {
return fetch(`https://recollect.net/api/places/${place}/services/${i}`).then(response => {
if (response.ok){
return response.json();
} else return {};
});
}
function discover_services(place) {
let existing_services = {};
@zevisert
zevisert / mailgun_validate.js
Created March 30, 2017 22:36
This file merges mailgun validation functionality with jQuery Validation Plugin's surprisingly poor async validation customizability.
/**
* Created by zevisert on 2017-03-27.
* This file merges mailgun validation functionality with jQueryValidationPlugin's surprisingly
* poor async validation customizability. Much of this code has been borrowed from
* * jQuery Validation remote method
* - https://github.com/jquery-validation/jquery-validation/blob/master/src/core.js#L1477
* * Mailgun validator jquery plugin
* - https://github.com/mailgun/validator-demo/blob/master/mailgun_validator.js#L30
*
*
@zevisert
zevisert / keybase.md
Created June 6, 2017 17:18
My online identity proof

Keybase proof

I hereby claim:

  • I am zevisert on github.
  • I am zevisert (https://keybase.io/zevisert) on keybase.
  • I have a public key ASCjvtZm5q54-yFoTOY8VfaO_J95DUq8TSeimtytiJBOFwo

To claim this, I am signing this object:

@zevisert
zevisert / mlp.ipynb
Created August 1, 2017 03:07
How I did NLP assignment 3 Q2 - maybe useful for our project as we move into MLP's
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@zevisert
zevisert / shadowdom-instagram-embed.html
Created September 29, 2017 09:12
Demo of an instagram embed in Shadow DOM
<html lang="en">
<head>
<title>Instagram in Polymer demo</title>
<!-- Import the webcomponents polyfill and Polymer -->
<base href="https://polygit.org/components/">
<script src="webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="polymer/polymer-element.html">
</head>
@zevisert
zevisert / gamepad-control.js
Last active April 15, 2018 07:29
Demo code for sending UDP datagrams from a Logitech Attack 3 joystick to a Roomba iRobot Create
var GamePad = require( 'node-gamepad' );
var dgram = require( 'dgram' );
var controller = new GamePad('logitech/attack3');
controller.connect();
var socket = dgram.createSocket('udp4');
socket.on('listening', function(){
socket.setBroadcast(true);
});
@zevisert
zevisert / all-polymer-builds.txt
Last active January 6, 2019 11:32
Polymer build configs
js.compile: "es2018"
# build name | browser capabilities
"2018-psm" | ["es2018", "push", "serviceworker", "modules"]
"2018-ps" | ["es2018", "push", "serviceworker"]
"2018-pm" | ["es2018", "push", "modules"]
"2018-sm" | ["es2018", "serviceworker", "modules"]
"2018-s" | ["es2018", "serviceworker"]
"2018-m" | ["es2018", "modules"]
"2018-p" | ["es2018", "push",]
"2018-0" | ["es2018"]