Skip to content

Instantly share code, notes, and snippets.

View chandu0101's full-sized avatar

Chandra Sekhar Kode chandu0101

  • Vijayawada,India
View GitHub Profile

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@japgolly
japgolly / SelectOne.scala
Created February 11, 2015 08:02
scalajs-react select example
import japgolly.scalajs.react._, vdom.prefix_<^._, ScalazReact._
import org.scalajs.dom.raw.HTMLSelectElement
import scala.scalajs.js
import scalaz.Equal
import scalaz.effect.IO
object SelectOne {
case class Choice[A](value : A,
label : String,
@sausman
sausman / CyaSS.jsx
Created February 21, 2015 22:13
CyaSS React Component - mimic :hover and :active with inline styles
import React from "react/addons";
import m from "./m";
// https://www.youtube.com/watch?v=GOiVYbWJDOA
export default class CyaSS extends React.Component {
constructor() {
super();
this.state = {
hover: false,
active: false
// Input Scala sources
def lightIsVisible(l: Vec, p: Vec) = {
val ray = Ray(p, l - p)
val length = (l - p).magnitude
var visible = true
for (i <- 0 until objects.length){
val (o, s) = objects(i)
val t = o.intersectionTime(ray)
if (t > Epsilon && t < length - Epsilon){
visible = false
@timperrett
timperrett / unfiltered-webjars.md
Created April 29, 2015 20:01
Using WebJars with Scala Unfiltered

Add the relevant webjars to your build file:

  libraryDependencies += "org.webjars.bower" % "angular" % "1.3.15"

Add the resources to your server definition:

unfiltered.netty.Server
@PerWiklander
PerWiklander / ItemSelector.scala
Created June 24, 2015 19:59
Traits to simplify making scalajs-react widgets
import scalaz.effect.IO
trait ItemSelector[ItemType] extends StatefulWidget[
ItemSelectorProps[ItemType],
ItemSelectorState[ItemType]
]
{
override def initialState = P => ItemSelectorState(P.selected)
}
case class ItemSelectorProps[ItemType](
Alternative for http://aperiodic.net/phil/scala/s-99/p21.scala
def insertAt[A](e: A, n: Int, ls: List[A]) =
ls.patch(n, List(e), 0)
insertAt('new,1,li) //> res1: List[Symbol] = List('a, 'new, 'b, 'c, 'd)
insertAt('new,0,li) //> res2: List[Symbol] = List('new, 'a, 'b, 'c, 'd)
insertAt('new,99,li) //> res3: List[Symbol] = List('a, 'b, 'c, 'd, 'new)
@idibidiart
idibidiart / GraphQL-Architecture.md
Last active September 16, 2023 18:36
Building an Agile, Maintainable Architecture with GraphQL

Building a Maintainable, Agile Architecture for Realtime, Transactional Apps

A maintainable application architecture requires that the UI only contain the rendering logic and execute queries and mutations against the underlying data model on the server. A maintainable architecture must not contain any logic for composing "app state" on the client as that would necessarily embed business logic in the client. App state should be persisted to the database and the client projection of it should be composed in the mid tier, and refreshed as mutations occur on the server (and after network interruption) for a highly interactive, realtime UX.

With GraphQL we are able to define an easy-to-change application-level data schema on the server that captures the types and relationships in our data, and wiring it to data sources via resolvers that leverage our db's own query language (or data-oriented, uniform service APIs) to resolve client-specified "queries" and "mutations" against the schema.

We use GraphQL to dyn

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@Jpoliachik
Jpoliachik / AppDelegate.m
Created December 19, 2016 15:25
ReactNative iOS Launch Screen No Flash
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// 1. init window
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
// 2. backgroundView using LaunchScreen.xib
UIView *backgroundView = [[[NSBundle mainBundle] loadNibNamed:@"LaunchScreen" owner:self options:nil] firstObject];
backgroundView.frame = self.window.bounds;