Skip to content

Instantly share code, notes, and snippets.

View tilomitra's full-sized avatar
👋

Tilo Mitra tilomitra

👋
View GitHub Profile
@tilomitra
tilomitra / scrollview.js
Created August 26, 2011 23:47
YUI3 Scrollview config to make scrolling feel smoother
var scrollView = new Y.ScrollView({
srcNode: '#resultList',
height: 260,
flick: {
minDistance:1,
minVelocity:0.4,
axis: "y"
},
deceleration: 0.983,
bounce:0.65,
@tilomitra
tilomitra / animations.css
Last active March 27, 2023 13:55
Common CSS Infinite Animations (pulsate, opacityPulse, alertPulse, rotating).
/* Make the element pulse (grow large and small slowly) */
/* Usage
.myElement {
animation: pulsate 1s ease-out;
animation-iteration-count: infinite;
opacity: 1;
}
*/
@-webkit-keyframes pulsate {
0% {-webkit-transform: scale(0.1, 0.1); opacity: 0.0;}
@tilomitra
tilomitra / react-snippet.jsx
Last active June 13, 2021 16:03
Run this through parceljs to embed on a Square Store via Snippets API
import React from "react";
import ReactDOM from "react-dom";
function Frontend() {
return <div>Sample Snippet Content - TESTING*******************</div>;
}
// self executing function here
(function () {
// your page initialization code here
YUI.add('event-hammer', function (Y, NAME) {
/*
Copyright 2013 Yahoo! Inc.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
'use strict';
//loop through Hammer.gestures
var HAMMER_GESTURES = [
@tilomitra
tilomitra / kafka-producer.js
Created April 10, 2020 23:11
Kafka Produer
import kafka from "kafka-node";
import uuid from "uuid";
const client = new kafka.Client("http://localhost:2181", "my-client-id", {
sessionTimeout: 300,
spinDelay: 100,
retries: 2
});
const producer = new kafka.HighLevelProducer(client);
@tilomitra
tilomitra / App.js
Last active November 28, 2019 21:55
A Recorder React component that interacts with the Houndify API
import React, { useState } from "react";
import Recorder from "./Recorder";
function App() {
const [convoState, setConvoState] = useState({});
const [response, setResponse] = useState("");
const [error, setError] = useState(null);
const [requestInfo, setRequestInfo] = useState({
UserID: "test_user",
Latitude: 37.388309,
@tilomitra
tilomitra / user-settings.json
Last active May 2, 2019 20:08
VS Code User Settings
{
"editor.formatOnSave": true,
// Enable per-language
"[javascript]": {
"editor.formatOnSave": true
},
"[json]": {
"editor.formatOnSave": true
},
"emmet.syntaxProfiles": {
@tilomitra
tilomitra / kafka-consumer.js
Last active June 6, 2018 04:32
Kafka Producer in NodeJS
import kafka from "kafka-node"
const client = new kafka.Client("http://localhost:2181");
const topics = [
{
topic: "webevents.dev"
}
];
const options = {
@tilomitra
tilomitra / kafka-consumer.js
Created November 6, 2017 20:01
Kafka Consumer in NodeJS
import kafka from "kafka-node"
const client = new kafka.Client("http://localhost:2181");
const topics = [
{
topic: "webevents.dev"
}
];
const options = {
@tilomitra
tilomitra / Gruntfile.js
Last active January 2, 2016 15:09
updated grunt-stripmq to work with css-media-match
'use strict';
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'tasks/**/*.js'
],