Skip to content

Instantly share code, notes, and snippets.

@darul75
darul75 / middleware_gin_v2.go
Last active December 15, 2023 08:04
Clerk Go SDK : Gin Web Framework middleware
package clerk
import (
"errors"
"net"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
@darul75
darul75 / backend.py
Last active April 15, 2021 07:18
stripe_flask_charge
from flask import Flask
from flask import render_template
from flask import request
from flask import json
from flask import jsonify
import stripe
app = Flask(__name__)
PUBLISHABLE_KEY = "pk_test...."
#!/usr/bin/ruby
require 'stripe'
Stripe.api_key = 'sk_test_4eC39HqLyjWDarjtT1zdp7dc'
# Maximum allowed
PAGE_SIZE = 100
# Displaying charge info
def display_charges_info(data)
@darul75
darul75 / stripe_webhook.js
Last active April 14, 2021 20:24
stripe_webhook.js
const app = require('express')();
/*
Instructions:
1) run your node server
--command to run--
> node stripe_webhook.js
@darul75
darul75 / stripe_invalid_request.cs
Last active April 14, 2021 20:07
stripe_invalid_request.cs
using System;
using System.IO;
using System.Net;
using System.Web;
using Newtonsoft.Json;
using System.Web.Mvc;
public class Program
{
public static void Main()
@darul75
darul75 / async.js
Created March 14, 2019 22:03 — forked from bschwartz757/async.js
Async/await function to fetch data from multiple URLs in parallel
/* Client side, works in Chrome 55 and Firefox 52 without transpilation */
//https://blogs.msdn.microsoft.com/typescript/2016/11/08/typescript-2-1-rc-better-inference-async-functions-and-more/
async function fetchURLs() {
try {
// Promise.all() lets us coalesce multiple promises into a single super-promise
var data = await Promise.all([
/* Alternatively store each in an array */
// var [x, y, z] = await Promise.all([
// parse results as json; fetch data response has several reader methods available:
//.arrayBuffer()
@darul75
darul75 / Google_oAuth.js
Created January 15, 2019 17:28 — forked from entaq/Google_oAuth.js
Google oAuth 2.0 sample
/**
reference -
https://developers.google.com/accounts/docs/OAuth2WebServer
https://code.google.com/apis/console/
https://developers.google.com/+/api/latest/
**/
////handle all requests here
function doGet(e) {
@darul75
darul75 / fetch-image-as-blob.js
Last active September 28, 2018 18:13
fetch image resources : works well with chrome extension
FetchImageAsBlob('https://gist.github.com/fluidicon.png', function(err, img) {
if (err) {
console.log(err);
return;
}
// play with img
});
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@darul75
darul75 / ramda.js
Created September 8, 2015 09:59
ramda functional js exercice
// Exercise 1
//==============
// Refactor to remove all arguments by partially applying the function
var words = function(str) {
return _.split(' ', str);
};
var match = R.curry(function(what, x) {
return x.match(what);