Skip to content

Instantly share code, notes, and snippets.

Avatar

James Lal lightsofapollo

View GitHub Profile
View error.logs
{ code:
'4/GwGg5miSAcd1wKy9Ye81SLrk6P5fqo46m_W9Vwh2KFBQgHhK-jA4cVsZn2XG57t7-Bdq4XHJ-uKPQvJdJjnkVIM' }
{ values:
{ code:
'4/GwGg5miSAcd1wKy9Ye81SLrk6P5fqo46m_W9Vwh2KFBQgHhK-jA4cVsZn2XG57t7-Bdq4XHJ-uKPQvJdJjnkVIM',
client_id:
'689324920305-m6h4n6blvhaalrgc89dese8s5tca9kol.apps.googleusercontent.com',
client_secret: '8OC4sIVWQotJuenxrfmFQL2i',
redirect_uri: 'https://conduitventures.consulting/auth/google',
grant_type: 'authorization_code',
View idea.graphql
scalar DateTime @class(name: "Date")
enum TaskStatus {
Created
InProgress
Done
}
input InputCreateTaskEntity {
ownerEmail: String! @IsEmail
View example.graphql
type User {
name: String!
@required
@string(min: 5)
}
View input.graphql
enum UserTypes {
SuperUser
Administrator
Customer
}
enum Gender {
"""
Men
"""
View gql-server.re
[@gql.name "AuthRoles"]
[@gql.comment "Authentication roles for all users"]
[@gql.type]
type authRoles = [ | `SuperUser | `Administrator | `User];
[@gql.type]
module User = {
type t = {
id: string,
email: string,
View foo.jsx
const handleChange = name => {
return e => {
this.setState({
[name]: e.target.value,
});
};
};
class Foo extends Component {
View test-cb.js
it('gets a route but is not authed', (done) => {
chai.request(server)
.get('/')
.end((err, res) => {
assert(res.request.url.endsWith('/login'),
'should be redirected to /login');
done();
});
});
View result_type.js
type Result<E, V> = [null, V] | [E, null];
const emailList = ['james@silklabs.com'];
function searchForEmail(email: string): Result<Error, bool> {
if (email.indexOf('@') === -1) {
return [new Error('this is not an email'), null];
}
// here we would do an actual search for the email ...
View eventwaiter.js
class EventWaiter {
_emitter: EventEmitter;
_event: string;
_promise: Promise<mixed>;
_accept: Function;
_onEvent = (value) => {
this._accept(value);
this._emitter.removeEventListener(this._event, this._onEvent);
View with_type.js
type BlobUploadInput = {
stuff: string;
};
class BlobUpload {
stuff: string;
constructor(obj: BlobUploadInput) {
Object.assign(this, obj);
}