This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WebsocketControllers::PostingsController < WebsocketRails::BaseController | |
def new_post | |
puts 'message:' + message | |
post = profile.posts.create!(content: message) | |
broadcast_message :new_post, format_post(post) | |
WebsocketRails[:posts].trigger(:new_post, format_post(post)) | |
end | |
##format_post is not being called |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Retrieve all posts on dashboard load | |
ajax1 = | |
$.ajax | |
async: true | |
type: 'GET' | |
url: '/posts.json' | |
success: (data) -> | |
$.when(ajax1, ractive).done (a1) -> | |
posts = a1[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//TradeWidget.coffee | |
ready = -> | |
dispatcher = new WebSocketRails($('#TradWidgetWrapper').data('uri'), true) | |
dispatcher.on_open = (data) -> | |
console.log('Connection has been established: ', data); | |
channel = dispatcher.subscribe 'trades' | |
channel.bind 'new_trade_post', (message) -> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uncomment and change this option to override the class associated | |
# with your `current_user` object. This class will be used when | |
# synchronization is enabled and you trigger events from background | |
# jobs using the WebsocketRails.users UserManager. | |
#config.user_class = User | |
# Used as the key for the WebsocketRails.users Hash. This method | |
# will be called on the `current_user` object in your controller | |
# if one exists. If `current_user` does not exist or does not | |
# respond to the identifier, the key will default to `connection.id` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PlotEx.Dygraph do | |
@derive [Poison.Encoder] | |
@default_options %{strokeWidth: 1, drawPoints: true, includeZero: true, gridLineColor: "#ddd", drawGrid: false, title: ""} | |
@options [:strokWidth, :drawPoints, :includeZero, :gridLineColor, | |
:drawGrid, :series, :dataHandler, :axes, :plotter, :animatedZooms, | |
:showInRangeSelector, :file, :showRangeSelector, :maxNumberWidth, | |
:gridLineWidth, :drawAxis, :yLabelWidth, :y2label, :ylabel, :xLabelHeight, | |
:xlabel, :titleHeight, :title, :panEdgeFraction, :displayAnnotations, :errorBars, :colorValue, | |
:sigma, :showRoller, :labels, :drawAxesAtZero, :legend, :visibility, :strokeBorderColor, | |
:logscale, :axis, :width, :height, :delimiter, :rollPeriod, :color, :colors, :connectSeparatedPoints, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PlantIt where | |
import Control.Concurrent.STM | |
import Control.Monad | |
data Card = Zero | |
| Half | |
| One | |
| Two | |
| Three |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Accounts where | |
-- , createUser, getUser, loginUser, | |
import Accounts.User (User(..), UserLogin(..), Accounts, users, createUser, getUser, initializeAccounts) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2009 the Sputnik authors. All rights reserved. | |
// This code is governed by the BSD license found in the LICENSE file. | |
/*--- | |
info: | | |
The elements of the array are rearranged so as to reverse their order. | |
The object is returned as the result of the call | |
esid: sec-array.prototype.reverse | |
es5id: 15.4.4.8_A1_T1 | |
description: Checking case when reverse is given no arguments or one argument |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.Aeson | |
import Web.HttpApiData (ToHttpApiData(..)) | |
instance FromJSON SFId where | |
parseJSON = withText "Id" $ \i -> do | |
return $ SFId i | |
instance ToJSON SFId where | |
toJSON (SFId i) = object | |
[ "Id" .= i ] |
OlderNewer