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 Counter do | |
use Agent | |
def start_link(initial_value) do | |
Agent.start_link(fn -> initial_value end, name: __MODULE__) | |
end | |
def value do | |
Agent.get(__MODULE__, & &1) | |
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 MovieData do | |
def start_link do | |
Agent.start_link(fn -> %{} end) | |
end | |
def add(pid, movie) do | |
Agent.update(pid, fn(state) -> | |
Map.put(state, movie, 1) | |
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
def create_comment(attrs \\ %{}) do | |
%Comment{} | |
|> Comment.changeset(attrs) | |
# TODO how to I get "post" here, to do the following step? | |
# |> Ecto.Changeset.put_assoc(:post, post) | |
|> Repo.insert() | |
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
// replicating SwitftUI Spacer() in React | |
import * as React from "react" | |
export function Spacer() { | |
return <div style={{ flex: "1 1 0" }}> </div> | |
} |
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
// | |
// Modal sheets on top of each other in SwiftUI | |
// Testing the possibilities | |
// | |
// ContentView.swift | |
// navTest1 | |
// | |
// Created by JOSEF RICHTER on 04/03/2020. | |
// Copyright © 2020 JOSEF RICHTER. Licence: do whatever you want, aka WTFPL http://www.wtfpl.net | |
// |
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
import * as React from "react" | |
import { | |
Frame, | |
FrameProps, | |
addPropertyControls, | |
ControlType, | |
} from "framer" | |
type Props = Partial<FrameProps> & |
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
import * as React from "react" | |
import { Frame } from "framer" | |
// change your presets here | |
const doubleTapMiliseconds = 300 | |
const longTapMiliseconds = 400 | |
export function TapRecognizer() { | |
const [tapTimestamp, setTapTimestamp] = React.useState(Date.now()) |
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
return <Frame style={style} onTap={this.onTap}> | |
<div style={{opacity:checkMarkOpacity, color: 'white'}}> | |
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 -1 24 24"><path fill="none" d="M0 0h24v24H0z"/><path fill="white" stroke="none" d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"/></svg> | |
</div> | |
</Frame>; |
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
import * as React from "react"; | |
import { Frame, PropertyControls, ControlType } from "framer"; | |
import { MoleculeLeftContentText } from "./MoleculeLeftContentText" | |
import { MoleculeLeftContentTextTwoLines } from "./MoleculeLeftContentTextTwoLines"; | |
const style: React.CSSProperties = { | |
height: 78, | |
marginLeft: 12, | |
marginRight: 12, | |
paddingLeft: 18, |
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
import UIKit | |
import WebKit | |
class MagazineViewController: UIViewController, UIWebViewDelegate { | |
@IBOutlet weak var webview: UIWebView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |