Skip to content

Instantly share code, notes, and snippets.

View tslim's full-sized avatar

TS Lim tslim

View GitHub Profile
def handle_action(params, _uri, socket) do
{:ok, apply_action(socket, socket.assigns.live_action, params)}
end
defp apply_action(socket, :index, _params) do
assign(socket, :page_title, "Index Page")
end
defp apply_action(socket, :show, _params) do
assign(socket, :page_title, "Show Page")
@tslim
tslim / mount.ex
Last active June 6, 2020 07:34
Learnings from my first LiveView app
def mount(_params, session, socket) do
{:ok,
socket
|> set_current_user(session)
|> subscribe_to_pubsub()
|> assign(:page, 1)
|> assign(:order_by, "name")
|> assign(:records, [])}
end

Keybase proof

I hereby claim:

  • I am tslim on github.
  • I am tslim (https://keybase.io/tslim) on keybase.
  • I have a public key ASAyya4c5oqd8px4yHjZrm4al7zOLVaahnvj-pW_5yrhdAo

To claim this, I am signing this object:

def update
current_user.update_attributes(params[:user])
respond_with current_user
end
class Dnscell.Routers.Domains extends Backbone.Router
routes: {
'dns_management/domains/': 'index'
'dns_management/domains': 'index'
'hosts/:id': 'hosts'
'dns_management/domains/:id': 'show_zone'
}
collection: null
show: (id) ->
entry = new Raffler.Models.Entry({id: id})
entry.fetch(
success: =>
console.log(entry.get('title'))
alert entry.get('name')
console.log(entry)
console.log(entry.attributes + " haha")
viewsangat = new Raffler.Views.Page({model: entry}) # Might one to declare this outside
viewsangat.render()
@tslim
tslim / gist:278ef6fd3c87a981e651
Last active August 29, 2015 14:13
CodeCamp KK Github Accounts
tslim
edthix
webgrrrl
faizalheesyam
endofline
ian9012
gamesbrewer
namor
adxicible
coderogue