This file contains 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
// Graciously adapted from https://www.youtube.com/watch?v=SlTkBe4YNbo&lc=UgwdZi_heg9VslLssQp4AaABAg | |
Shader "Unlit/Outline" | |
{ | |
Properties{ | |
_Color("Main Color", Color) = (0,0,0,1) | |
_OutlineColor("Outline color", color) = (0,0,0,1) | |
_OutlineWidth("Outline width", Range(1.0,5.0)) = 1.01 | |
} | |
SubShader{ |
This file contains 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 Game do | |
require Board | |
defstruct board: %Board{} | |
def is_complete?(%Game{ board: board } = game) do | |
Board.has_winner?(board) or Board.is_draw?(board) | |
end | |
end |
This file contains 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 MyViewTest do | |
use MyAppWeb.ConnCase | |
import Phoenix.LiveViewTest | |
import Mock | |
require MyView | |
require MyDataFetcher | |
test "it renders the fetched data", %{conn: conn} do |
This file contains 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 MyView do | |
use MyAppWeb, :live_view | |
def mount(_params, _session, socket) do | |
send(self(), {:load_data}) | |
{:ok, | |
assign(socket, | |
data: "" | |
)} |
This file contains 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
var deferrable = function (cb) { | |
function getFunctionBody(code) { | |
var functionDef = code.match(/\{(.|[\r\n])+\}/); | |
// Strip body of all useless chars | |
return functionDef[0].replace(/\{|\}/g, '') | |
} | |
var | |
// Grab the entire defer() block |
This file contains 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
function parseFunctionArguments (obj) { | |
for (var method in obj) { | |
if (obj.hasOwnProperty(method) && typeof obj[method] === 'function') { | |
(function (method) { | |
var func = obj[method]; | |
obj[method] = function () { | |
// Try to convert each string arg into an object literal | |
var converted = [].map.call(arguments, function (v) { | |
if (typeof v === 'string') { |