Skip to content

Instantly share code, notes, and snippets.

View anand9's full-sized avatar

Anand Vasudevan anand9

  • Aeka
  • Bangalore, India
View GitHub Profile
@anand9
anand9 / jquery.alterclass.js
Created May 19, 2016 18:14 — forked from peteboere/jquery.alterclass.js
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
/**
* jQuery alterClass plugin
*
* Remove element classes with wildcard matching. Optionally add classes:
* $( '#foo' ).alterClass( 'foo-* bar-*', 'foobar' )
*
* Copyright (c) 2011 Pete Boere (the-echoplex.net)
* Free under terms of the MIT license: http://www.opensource.org/licenses/mit-license.php
*
*/
@anand9
anand9 / Coding Puzzle
Last active August 29, 2015 14:06
Coding puzzle for Ineight #ui_dev
Hi,
The requirement is as follows
The app should be a standalone UI app, which can be built on top of Angular js (or any MVC js framework) or ember or any MVC js frameworks
The app should be connected to a twitter api, from which you can get updates from a particular handle (Eg: @rihanna)
When the handle posts a new update, the app should show a notification (without manual efforts) that there is a new tweet and should Display the new tweet within the application.
Feel free to use any css frameworks
It should be grid based
The app should have a ~good~ UI
It can be a single page app
@anand9
anand9 / faye-client.html
Created March 2, 2013 10:10
The faye client which sends messages,
<script type="text/javascript">
var client = new Faye.Client('http://localhost:9292/faye');
var message = client.publish('/foo', {text: message ,id: id, :number: number });
</script>
@anand9
anand9 / faye-monitor.html
Created March 2, 2013 10:09
Faye monitor which receives messages from all clients
<script type="text/javascript">
var client = new Faye.Client('http://localhost:9292/faye');
client.subscribe('/foo', function(message) {
$('#message').append('<p>'+message.number+ ' => ' +message.text+ '</p>'); // doing the UI stuff :)
$('#id').text(message.id);
});
</script>
@anand9
anand9 / faye_listen.rb
Last active December 14, 2015 01:39
receives push messages
require 'eventmachine'
require 'faye'
EM.run {
client = Faye::Client.new('http://0.0.0.0:9292/faye')
client.subscribe('/anand9_calendar') do |message| | #a unique id is used as the channel name like calendar id
puts message.inspect
end
@anand9
anand9 / faye_send.rb
Last active December 14, 2015 01:39
sending push notifications
require 'eventmachine'
require 'faye'
message = "Hello world"
EM.run {
client = Faye::Client.new('http://0.0.0.0:9292/faye')
client.publish('/anand9_calendar', 'text' => message) | #a unique id is used as the channel name like calendar id
puts "pushed #{message}"
<%= check_box_tag "unsubscribe_email[]", checked_value = "1", unchecked_value = "0" %>