Skip to content

Instantly share code, notes, and snippets.

Josef Richter josefrichter

Block or report user

Report or block josefrichter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View blog.ex
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
@josefrichter
josefrichter / Spacer.tsx
Created Apr 10, 2020
replicating SwitftUI Spacer() in React
View Spacer.tsx
// replicating SwitftUI Spacer() in React
import * as React from "react"
export function Spacer() {
return <div style={{ flex: "1 1 0" }}>&nbsp;</div>
}
View ContentView.swift
//
// 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
//
@josefrichter
josefrichter / ComponentBoilerplate.tsx
Last active Oct 15, 2019 — forked from steveruizok/Example.tsx
An example Framer X code component.
View ComponentBoilerplate.tsx
import * as React from "react"
import {
Frame,
FrameProps,
addPropertyControls,
ControlType,
} from "framer"
type Props = Partial<FrameProps> &
View TapRecognizer.jsx
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())
View CheckBox.tsx
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>;
@josefrichter
josefrichter / OrganismCard.tsx
Created Sep 22, 2018
slot pattern for framer x
View OrganismCard.tsx
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,
View MagazineViewController.swift
import UIKit
import WebKit
class MagazineViewController: UIViewController, UIWebViewDelegate {
@IBOutlet weak var webview: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
View index.jsx
class Application extends React.Component {
constructor() {
super();
this.state = {
currentUser: null,
joinError: null,
};
}
View index.jsx
const _fbBase = new Firebase('https://•••••••••.firebaseIO.com');
_fbBase.child('users/'+newUserID+'/conversations').on('value', function(snap){
var obj = snap.val();
var arr = Object.keys(obj).map(function (key) {return obj[key]}); // just converting to array - http://stackoverflow.com/a/26166303
_this.setState({conversations: arr});
});
class ConvoList extends React.Component {
You can’t perform that action at this time.