Skip to content

Instantly share code, notes, and snippets.

View ikbelkirasan's full-sized avatar

Ikbel ikbelkirasan

View GitHub Profile
@ikbelkirasan
ikbelkirasan / duplicate_project_asana.js
Last active June 17, 2021 12:52
Duplicate project in Asana via Zapier Code step
const { projectId, teamId, newProjectName, accessToken } = inputData;
const payload = {
data: {
name: newProjectName,
team: teamId,
include: [
"members",
"notes",
"task_notes",
@ikbelkirasan
ikbelkirasan / http_toolkit1.fish
Last active April 8, 2021 10:28
HTTP Toolkit script for fish shell
export http_proxy="http://127.0.0.1:8000"
export HTTP_PROXY="http://127.0.0.1:8000"
export https_proxy="http://127.0.0.1:8000"
export HTTPS_PROXY="http://127.0.0.1:8000"
export GLOBAL_AGENT_HTTP_PROXY="http://127.0.0.1:8000"
export CGI_HTTP_PROXY="http://127.0.0.1:8000"
export npm_config_proxy="http://127.0.0.1:8000"
export npm_config_https_proxy="http://127.0.0.1:8000"
export npm_config_scripts_prepend_node_path="false"
export GOPROXY="http://127.0.0.1:8000"
@ikbelkirasan
ikbelkirasan / main.js
Last active January 19, 2021 16:51
Test Gist (Code Step)
// this is wrapped in an \`async\` function
// you can use await throughout the function
// and another one
@ikbelkirasan
ikbelkirasan / debounce.ts
Last active December 27, 2020 00:29
Debounce a function (Typescript)
type Fn = (...args: any[]) => any;
type Callback<F extends Fn> = F extends Fn
? (...args: Parameters<F>) => ReturnType<F>
: never;
function debounce<T extends Fn, O extends Callback<T>>(
func: O,
wait: number,
immediate?: boolean
): O {
@ikbelkirasan
ikbelkirasan / require_lodash_from_cdn_node.js
Created October 6, 2020 18:58
Require lodash from CDN in Node
const fetch = require("node-fetch");
const vm = require("vm");
async function requireLodash(url) {
const context = {};
const rawData = await fetch(
"https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"
).then((res) => res.text());
vm.runInNewContext([rawData, "global.lodash = _"].join("\n"), {
global: context,
@ikbelkirasan
ikbelkirasan / config.fish
Created September 19, 2020 16:55
Autoload fish functions and env variables per directory
function load_local_fish_functions --on-variable PWD
if test -e .autoload.fish
source ./.autoload.fish
end
end
load_local_fish_functions
@ikbelkirasan
ikbelkirasan / extract_reply.js
Created June 6, 2020 12:51
Code Step for extracting Email Reply
var EmailParser=function(t){var r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)n.d(e,o,function(r){return t[r]}.bind(null,o));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p="",n(n.s=59)}([function(t,r){var n=Array.isArray;t.exports=n},function(t,r,n){var e=n(31),o="object"==ty
@ikbelkirasan
ikbelkirasan / retry_fn.js
Created February 28, 2020 16:07
Retry a function call
const retry = require("retry");
const sinon = require("sinon");
const sendRequest = sinon.stub();
sendRequest.onFirstCall().rejects(new Error("yaw kiw 1"));
sendRequest.onSecondCall().rejects(new Error("yaw kiw 2"));
sendRequest.onThirdCall().resolves({ message: "it works" });
const operation = retry.operation({
retries: 2,
@ikbelkirasan
ikbelkirasan / findZapForWebhookURL.js
Last active May 16, 2024 20:51
Find the zap that matches a webhook URL.
{
const getNodes = zap => {
let nodes = [];
for (let nodeId in zap.nodes) {
const node = zap.nodes[nodeId];
nodes.push(node);
}
return nodes;
};
@ikbelkirasan
ikbelkirasan / mongo-docker-compose.yml
Created October 18, 2019 11:40
docker-compose presets
version: '3.0'
services:
mongo:
image: mongo
restart: unless-stopped
ports:
- 27017:27017
environment:
MONGO_INITDB_ROOT_USERNAME: root