Skip to content

Instantly share code, notes, and snippets.

async function chargeCreate ({ amount, source, description, currency }) {
//do some stuff before the function
await someService.doAsyncStuff(amount, currency, description);
try {
const charge = await stripe.charges.create.apply(stripe.charges, arguments);
//do some stuff after the function
myTraceService.log(`New charge ${charge.amount}`);
return charge;
} catch (e) {
// do something with the error if you want to
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@yonjah
yonjah / gist:5082855
Last active February 10, 2023 19:25
Blocking DDOS bots with JavaScript for fun and profit! Or how easy it is to break the current protection methods and how to make it better.
TL;DR - jump to the challenge at the end
====ON BLOCKING EVIL BOTS=====
On a resent job interview I had for "Incapsula" a few days ago I was put to the challenge to break
their bot protection mechanism. Apparently node.js is not that common among bot writes and most bots
are not able to run javascript.
The challenge had two parts -
1. find what the code does.
2. implement a bot that will break the code without using js.
3. think how to make this code unbreakable