Skip to content

Instantly share code, notes, and snippets.

View tarang9211's full-sized avatar
🦖
Focusing

Tarang Hirani tarang9211

🦖
Focusing
View GitHub Profile
/** routes/branches/index.js */
module.exports = function() {
router.get()
router.post()
}
/** routes/index.js */
module.exports = function() {
typealias DCRequestType = (URLRequest, Error)
//basically makePostRequest should be a function that returns a URLRequest. Straightforward.
// I want the return type to be either a URlRequest or an Error. <URLRequest, Error> something of this kind.
// You see what I'm doing right?
fileprivate func makePostRequest(apiUrl: String, params: [String: String]) -> <URLRequest, Error> {
// build url
let urlString = "\(dcoderURL)\(apiUrl)"
guard let serviceUrl = URL(string: urlString) else { return nil }
Mutation: {
login: (parent, args, context, info) => {
const { email } = args;
const user = getUserByEmail(email);
console.log(context);
if (user) {
context.req = {
...context.req,
session: user
}
@tarang9211
tarang9211 / CurvedUIView.swift
Created May 28, 2019 19:01 — forked from anitaa1990/CurvedUIView.swift
A Swift extension of UIView to display a curved view
import UIKit
extension UIView {
/* Usage Example
* bgView.addBottomRoundedEdge(desiredCurve: 1.5)
*/
func addBottomRoundedEdge(desiredCurve: CGFloat?) {
import React from 'react';
import { Navbar } from 'shared/components';
import { Query } from 'react-apollo';
import gql from 'graphql-tag';
const Home = () => {
return (
<>
<Navbar isAuthenticated={true} />
<div className="container">
/** Fetch all conferences */
let selectConferencesQuery;
try {
selectConferencesQuery = await query(
'SELECT id, name, description, dates, tags, image FROM conferences'
);
} catch (e) {}
/** Fetch the count of subevents related to a conference */
const conferenceIds = selectConferencesQuery.results.map(
import { ApolloError } from 'apollo-server';
import jwt from 'jsonwebtoken';
import ConferenceModel from '../models/conference';
import SubeventModel from '../models/subevent';
import uploadImage from '../utils/image-upload';
export default {
Mutation: {
async createConference(roots, args, context) {
const { token } = context;
import React, { Component } from 'react';
import styles from './step-list.module.scss';
class StepList extends Component {
steps = [
{ key: 0, title: 'Overview' },
{ key: 1, title: 'Dates' },
{ key: 2, title: 'Add Seminars' },
{ key: 3, title: 'Upload an image' },
{ key: 4, title: 'Preview' }
import React, { Component } from 'react';
class App extends Component {
state = {
inputs: [],
showState: false
};
handleSubmit = (event) => {
event.preventDefault();
import React, { Component } from 'react';
class App extends Component {
state = {
inputs: [],
showState: false
};
handleSubmit = (event) => {
event.preventDefault();