Skip to content

Instantly share code, notes, and snippets.

View p0o's full-sized avatar

Pooria Atarzadeh p0o

View GitHub Profile
@p0o
p0o / deployment_script.js
Last active January 6, 2021 06:00
Github Deployment Runner Webhook
// This nodejs script can run in the background and execute a deployment bash script on every
// successful pull request merge (using Github webhooks)
// It can be easily extended to listen on multiple repositories as well
const http = require('http');
const createHandler = require('github-webhook-handler');
const shell = require('shelljs');
// We avoid to hardcode the secret in the code, you should provide it with an ENV variable before running this script
const { MY_SECRET } = process.env;

Keybase proof

I hereby claim:

  • I am p0o on github.
  • I am p0oker (https://keybase.io/p0oker) on keybase.
  • I have a public key ASD-QO9xRSMlAqDVozZVAVuCjDn7CRZoxb6a5ZdRIEdEFgo

To claim this, I am signing this object:

@p0o
p0o / algorithms.md
Created September 20, 2019 07:15
JavaScript Algorithm Practice

Binary Tree Traversals

Pre-Order Traversal

/**
 * Definition for a binary tree node.
 * function TreeNode(val) {
 *     this.val = val;
 *     this.left = this.right = null;
 * }
@p0o
p0o / post-merge
Created September 26, 2018 08:27 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@p0o
p0o / mini-project.md
Last active May 22, 2017 17:12
Interview mini project task

Introduction

Thank you for spending the time to do this task. In this task we expect you to create a new repo (preferrably in Github) and setup a basic working environment. Your working environment needs to have a development environment for devs to work on the project and a production build to make a final bundle of the javascript. You can make your own technology choices.

Mini Project

Steemit is a social network created on top of a blockchain. All the data in the website is available from their own API and the easiest way to work with their API is using Steem-js library. Your project should use steem-js to work with Steem API. Use the API to fetch the last 10 articles in the trending tab of the website and show them similar to the website.

@p0o
p0o / addToSet.js
Created September 26, 2016 13:52
Adding item to a List[] Using Set() data structure and returning a serializable array - To be used in JSON state managers like Redux
/**
* Adding item to a List[] Using Set() data structure and returning a serializable array
* @param {String} newItem to be added
* @param {Array} list of current array
* @returns {Array} New item added without repetition
*/
const addToSet = (newItem, list) => {
const itemsSet = new Set();
const newList = [];
@p0o
p0o / LICENSE
Last active August 29, 2015 14:27 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

Keybase proof

I hereby claim:

  • I am p0o on github.
  • I am p0o (https://keybase.io/p0o) on keybase.
  • I have a public key whose fingerprint is CAB5 25FC C648 0BDF 0380 7D62 A098 50CA 1884 8CE4

To claim this, I am signing this object:

@p0o
p0o / dabblet.css
Last active August 29, 2015 14:26
Pie Chart
/**
* Pie Chart
*/
body {
background: White;
}
@keyframes piechart-start {
100% {
transform: rotate(0.5turn); }