Skip to content

Instantly share code, notes, and snippets.

View MartianLee's full-sized avatar
๐Ÿข
working hard with Javascript

SeongHwa Joy MartianLee

๐Ÿข
working hard with Javascript
View GitHub Profile
@MartianLee
MartianLee / user_broadcast_job.rb
Created January 29, 2019 17:12
์œ ์ €์˜ ํ”„๋กœํ•„์„ ๊ฐฑ์‹ ํ•˜๋Š” job์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
class UserBroadcastJob < ApplicationJob
include Sidekiq::Worker
def perform(user_id)
begin
user = User.find_by(id: user_id)
return if user.blank?
stages = user.meeting.stages
stages.each do |stage|
if stage.polls.present?
ActionCable.server.broadcast("poll_dashboard_channel-#{user.meeting.id}", {
@MartianLee
MartianLee / poll_dashboard.js
Created January 29, 2019 16:57
์œ ์ € ํ”„๋กœํ•„์˜ ๊ฐฑ์‹ ์„ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๋ฐ˜์˜ํ•ฉ๋‹ˆ๋‹ค.
App.dashboard = App.cable.subscriptions.create({ channel: "PollDashboardChannel", meeting_id: meeting_id, stage_item_type: 'Poll', stage_item_id: poll_id }, {
received: function(data) {
.....
switch(data.action) {
......
case 'destroy':
......
break;
case 'update_user_image':
@MartianLee
MartianLee / users_controller.rb
Last active January 29, 2019 17:25
users_controller.rb์—์„œ ํ”„๋กœํ•„์ด ์—…๋ฐ์ดํŠธ๋  ๋•Œ broadcast๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
def update
......
if @user.update_attributes(user_params)
flash[:success] = '์ €์žฅ๋˜์—ˆ์Šต๋‹ˆ๋‹ค'
broadcast_user_updated(@user)
redirect_to @meeting
else
.....
end
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#include <sys/signalfd.h>
#include <sys/time.h>
#include <sys/types.h>
#define handle_error(msg) \