Skip to content

Instantly share code, notes, and snippets.

Avatar

Abhi Aiyer abhiaiyer91

  • Workpop
  • Los Angeles
View GitHub Profile
View error.logs
DEBUG: yarn.lock needs updating (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
DEBUG: Updated 2 lock files (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
"updatedArtifacts": ["package-lock.json", "yarn.lock"]
DEBUG: 3 file(s) to commit (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
DEBUG: Committing files to branch renovate/react-helmet-6.x (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
DEBUG: Error commiting files (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
"err": {
"task": {
"commands": [
"push",
View example-renovate.config.js
module.exports = {
/* endpoint: 'https://api.github.com/', */
token: 'xxx',
platform: 'github',
logLevel: 'debug',
onboardingConfig: {
extends: ['config:base'],
},
repositories: ['julienp-test-org/gatsby-starter-blog'],
renovateFork: true,
View ticketStealing.js
// You're hosting an event, and the admission tickets are expensive. Groups of people are trying to cheat the system by using the same tickets multiple times. Stop them!
// 1) Create a constructor function called Ticket that takes one parameter, code, and creates a Ticket object.
// The Ticket object will have the following parameters:
// code : a string that stores the ticket code
// used : a boolean that stores whether or not the ticket has been used yet
// useTicket: a function registers that the ticket has been used and prevents reuse or tampering
// 2) Create a function called validTicket to check whether the ticket is valid and return true or false. For a ticket to be valid,
// the ticket code must match the correct code, and the ticket must be unused.
View multi-table.js
// Print out the grade-school multiplication table up to 12x12
function multiplicationTable(maxValue) {
for (var i = 1; i <= maxValue; i++) {
let line
for (var j = 1; j <= maxValue; j++) {
line = line + ` ${j * i}`;
}
console.log(line)
}
View post2.ts
/** rest of code above **/
server.get("/post/:id", async (req, res) => {
const postId = req.params.id;
// Use the post API from prisma client
try {
const post = await prisma.post({
id: postId
});
const author = await prisma
View postsdrafts.ts
/** rest of code above **/
server.get("/posts", async (_req, res) => {
// Use the posts API from prisma client
try {
const posts = await prisma.posts({
where: {
published: true
}
});
View post.ts
/** rest of code above **/
server.get("/post/:id", async (req, res) => {
const postId = req.params.id;
// Use the post API from prisma client
try {
const post = await prisma.post({
id: postId
});
View publishpost.ts
/** rest of code above **/
server.post("/post/publish/:id", async (req, res) => {
const postId = req.params.id;
// Use the updatePost API from prisma client
try {
const publishedPost = await prisma.updatePost({
where: {
id: postId
},
View createpost.ts
/** rest of code above **/
server.post("/create/draft", async (req, res) => {
const { title, authorId } = req.body;
// Use the createPost API from prisma client
try {
const draftPost = await prisma.createPost({
title,
author: {
connect: {
View user.ts
/** rest of code above **/
server.get("/user/:id", async (req, res) => {
const userId = req.params.id;
// Use the user API from prisma client
try {
const user = await prisma.user({
id: userId
});
You can’t perform that action at this time.