Skip to content

Instantly share code, notes, and snippets.

Avatar

Anand Vasudevan anand9

View GitHub Profile
@anand9
anand9 / jquery.alterclass.js
Created May 19, 2016 — forked from peteboere/jquery.alterclass.js
jQuery alterClass plugin: Remove element classes with wildcard matching. Optionally add classes.
View jquery.alterclass.js
/**
* 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 Aug 29, 2015
Coding puzzle for Ineight #ui_dev
View Coding Puzzle
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 Mar 2, 2013
The faye client which sends messages,
View faye-client.html
<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 Mar 2, 2013
Faye monitor which receives messages from all clients
View faye-monitor.html
<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 Dec 14, 2015
receives push messages
View faye_listen.rb
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 Dec 14, 2015
sending push notifications
View faye_send.rb
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}"
View gist:3377412
<%= check_box_tag "unsubscribe_email[]", checked_value = "1", unchecked_value = "0" %>
You can’t perform that action at this time.