Skip to content

Instantly share code, notes, and snippets.

View egtann's full-sized avatar

Evan Tann egtann

View GitHub Profile
class Jambox.Views.SongsShow extends Backbone.View
....
initialize: (id) ->
@song = new Jambox.Models.Song(id: id)
@song.fetch(success: => @updateSong) # 'updating song'
@tracks = new Jambox.Collections.Tracks(song_id: id)
@tracks.fetch
success: =>
console.log(this) # SongsShow View
// Send a message to.... No name pops up
<template name="messaging">
<h3>Send a message to {{name}}</h3>
</template>
// Renders template correctly, but Template.messaging.name = ""
$(event.target).after(
Meteor.render( function() {
return Template.messaging({name: this.name});
})
// ---------------------------------------------------------------------------
// Example RoverBot with Basic Obstacle Avoidance
// ---------------------------------------------------------------------------
#include <NewPing.h>
#include <AFMotor.h>
#define TRIGGER_PIN 34 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 28 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
@egtann
egtann / restaurants.go
Created July 9, 2016 18:06
Abot v0.3 API WIP
func init() {
// plugin.AddTrigger replaces plugin.SetKeywords. Rather than specify
// all Commands and Objects, Abot will automatically handle that for
// you based on a few example sentences.
plugin.AddTrigger(p, kwRecommendRestaurants, []string{
// This also matches similar sentences, like "where's a place
// to eat?", "is there a place to gnosh closeby?", "find me a
// good eatery", "locate a steakhouse for me", and "I want to
// go out to eat tonight" automatically.
"Find me a restaurant nearby",

Keybase proof

I hereby claim:

  • I am egtann on github.
  • I am egtann (https://keybase.io/egtann) on keybase.
  • I have a public key ASCtM674Gzrnr4qiKtICZB5jtnYcUbF8VMReIuGa6jg5Kwo

To claim this, I am signing this object:

@egtann
egtann / tensorflow_self_check.py
Created August 20, 2017 15:37 — forked from mrry/tensorflow_self_check.py
TensorFlow on Windows self-check
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@egtann
egtann / example.templ
Last active May 10, 2024 04:44
Using a strict CSP with HTMX and Templ
// Example component with styling and script tags. The script+style will work even when
// retrieved after page load via HTMX because of our X-Nonce header/middleware.
templ MyComponent() {
<style nonce={ nonceFrom(ctx) }>
.red {
color: red;
}
</style>
<script nonce={ nonceFrom(ctx) }>