Skip to content

Instantly share code, notes, and snippets.

import Foundation
struct MovieInfo: Codable {
let name: String?
let releaseDate: String?
let daysSinceRelease: Int?
let collection: String?
let posterUrl: String?
enum CodingKeys: String, CodingKey {
import UIKit
import AuthenticationServices
class LoginViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
setupAppleSignIn()
}
@pallavtrivedi03
pallavtrivedi03 / Aciton.js
Created March 15, 2019 09:13
Route for handling user action (SlackAppDemo)
router.post('/actions', async (req, res) => {
try {
const payload = JSON.parse(req.body.payload);
console.log("###slack request is "+payload);
var response = "";
if (payload.callback_id === 'query_selection') {
console.log("option selected is "+payload.actions[0].selected_options[0].value);
switch (payload.actions[0].selected_options[0].value) {
case "openIssues":
@pallavtrivedi03
pallavtrivedi03 / QueryOptions.js
Created March 15, 2019 07:49
Query options for SlackAppDemo
const queryOptions = [{
text: 'Open Issues',
value: 'opneIssues'
}, {
text: 'Closed Issues',
value: 'closedIssues'
}, {
text: 'Milestones',
value: 'milestones'
}, {
@pallavtrivedi03
pallavtrivedi03 / SlashCommand.js
Created March 15, 2019 07:46
Slash command route (for SlackAppDemo)
router.post('/SlackAppDemo',function(req,res) {
try {
const response = {
response_type: 'in_channel',
channel: req.body.channel_id,
text: 'Hey there...:',
attachments: [{
text: 'What would you like to know in this project?',
fallback: 'What would you like to know in this project?',
color: '#2c963f',
@pallavtrivedi03
pallavtrivedi03 / app.js
Created January 7, 2019 14:03
App.js file for Moviepedia
const express = require('express');
const bodyParser = require('body-parser');
const graphqlHttp = require('express-graphql');
const {buildSchema} = require('graphql');
const mongoose = require('mongoose');
const movieSchema = require('./models/movie-schema');
const Movie = require('./models/movie');
var app = express();
@pallavtrivedi03
pallavtrivedi03 / resolvers.js
Created January 7, 2019 13:54
Resolvers for Movie schema
movies: () => {
return Movie.find()
.then(movies => {
return movies.map(movie => {
return { ...movie._doc, _id: movie._doc._id.toString()}; //overwriting id
});
})
.catch(err => {
throw err;
});
@pallavtrivedi03
pallavtrivedi03 / movie-schema.js
Created January 7, 2019 13:35
GraphQL schema for Movie
module.exports = {'movieBuildSchema':`
type Movie {
_id: ID!
title: String!
year: Int!
released: String!
genre: String!
director: String!
actors: String!
plot: String!
@pallavtrivedi03
pallavtrivedi03 / movie.js
Created January 7, 2019 13:32
MongoDB model for Movie
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const movieSchema = new Schema({
title: {
type: String,
required: true
},
year: {
extension HomeViewController: DragDropViewDelegate
{
func draggedMediaType(type: MediaType, url: NSURL) {
switch type {
case .audio:
self.createDirectory(sourcePath: url.absoluteString!, type: .audio)
case .video:
self.createDirectory(sourcePath: url.absoluteString!, type: .video)
case .image:
self.createDirectory(sourcePath: url.absoluteString!, type: .image)