Skip to content

Instantly share code, notes, and snippets.

View form_example.html.eex
<div class="<%= container_css() %> py-10">
<div class="md:grid md:grid-cols-3 md:gap-6">
<div class="md:col-span-1">
<div class="px-4 sm:px-0">
<h3 class="text-lg font-medium leading-6 text-gray-900">Change your name</h3>
</div>
</div>
<div class="mt-5 md:mt-0 md:col-span-2">
<%= form_for @name_changeset, Routes.user_settings_path(@conn, :update_name), fn f -> %>
<div class="shadow sm:rounded-md sm:overflow-hidden">
View live_view.ex
defmodule AppWeb.PageLive do
use AppWeb, :live_view
alias App.Posts
alias App.Posts.Post
alias App.Votes
@impl true
def mount(_params, session, socket) do
socket = maybe_assign_user(session, socket)
View gist:a274e699b88538df4b63fb66c46af663
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@mplatts
mplatts / 0firebase_functions_cheatsheet.js
Last active Feb 7, 2020
Firebase functions cheatsheet
View 0firebase_functions_cheatsheet.js
// Core
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
const db = admin.database();
admin.auth().createUser({
uid: uid,
displayName: displayName,
photoURL: photoURL
@mplatts
mplatts / backbone_testing.coffee
Last active Jun 20, 2019
Backbone Testing Cheatsheet
View backbone_testing.coffee
# Libraries used:
# jasmine
# jasmine-jquery
# jasmine-sinon
# sinon
##### Basics Overview #####
describe "APP_NAME.Views.VIEW_FOLDER.VIEW_NAME ", ->
beforeEach ->
@mplatts
mplatts / command_line.sh
Last active Aug 14, 2017
Elixir Phoenix Cheatsheet
View command_line.sh
mix help
iex -S mix phx.server # like rails c
h Enum => shows help for Enum
Dossy.Accounts.__info__(:functions) => will list functions in this module
mix phx.routes
# DATABASE
mix ecto.gen.migration add_weather_table
mix ecto.migrate
@mplatts
mplatts / contacts.rb
Last active Feb 20, 2017
Rest properties fields
View contacts.rb
{
:alpha => "WILL L", # user.rest_alpha ?
:name => "Lynne Williams", # user.first_name, user.last_name
:leasename => "Lynne Williams", # ???
:leaseshortname => "Lynne Williams", # ???
:postalline1 => "27B Fisher Avenue", # user.address_line_one
:postalline3 => "Southport Qld 4215", # user.address_line_two
:tenantsuburb => "Southport", # user.suburb
:tenantstate => "Qld", # user.state
:tenantpcode => 4215, # user.postcode
@mplatts
mplatts / games.coffee
Last active Apr 10, 2016
templates2 - 1
View games.coffee
# lib/collections/games.coffee
@Games = new Mongo.Collection('games')
@mplatts
mplatts / games.coffee
Last active Apr 10, 2016
templates2 - 3
View games.coffee
# client/views/games.coffee
Template.games.helpers
games: -> Games.find()
@mplatts
mplatts / games.coffee
Last active Apr 10, 2016
templates2 - games.coffee
View games.coffee
# client/views/games.coffee
Template.games.helpers
teams: -> Teams.find()
games: -> Games.find()
creating: -> Session.get 'creating-game'
Template.games.events
"click .create": (e, tpl) ->
e.preventDefault()