Skip to content

Instantly share code, notes, and snippets.

View jimleestone's full-sized avatar
Workaholic

十六夜かぐや jimleestone

Workaholic
  • 次元の狭間
View GitHub Profile
@derek-fong
derek-fong / serverless-v2.yml
Created August 5, 2020 13:18
How to Build a Serverless Apollo GraphQL Server with AWS Lambda, Webpack and TypeScript
service: demo-apollo-server-lambda
provider:
name: aws
runtime: nodejs12.x
region: ap-southeast-2
functions:
graphql:
handler: src/apollo-server.graphqlHandler
events:
- http:
@banyudu
banyudu / axios_proxy.ts
Created February 3, 2020 08:06
setup axios proxy with shadowsocks
// change host / port / protocol to your real values
const axiosOptions: AxiosRequestConfig = {}
const httpsAgent = new SocksProxyAgent({
host: '127.0.0.1',
port: 1086,
protocol: 'socks5:',
rejectUnauthorized: false
})
axiosOptions.httpAgent = httpsAgent
@salgmachine
salgmachine / OAuth2AuthorizationServerConfigJwt.java
Last active March 20, 2024 19:56
JWE/JWT with Spring Boot 2 and Nimbus JOSE JWT
// this is based on code from https://www.baeldung.com/spring-security-oauth-jwt
// also based on code from https://connect2id.com/products/nimbus-jose-jwt/examples/signed-and-encrypted-jwt and https://connect2id.com/products/nimbus-jose-jwt/examples/jwt-with-rsa-encryption
// used com.nimbusds:nimbus-jose-jwt:6.4.2
// interesting bits at lines 120 - 188
/**
* THIS IS JUST A PROOF OF CONCEPT. DO NOT USE IN PRODUCTION.
*/
import java.text.ParseException;
import java.util.Arrays;
@msievers
msievers / [Spring, JMH] Howto integrate JMH benchmarks with Spring.md
Last active March 14, 2026 16:38
[Spring, JMH] Howto integrate JMH benchmarks with Spring

Motivation

Integrate JMH (Java Microbenchmarking Harness) with Spring (Boot) and make developing and running benchmarks as easy and convinent as writing tests.

Idea

Wrap the necessary JMH boilerplate code within JUnit to benefit from all the existing test infrastructure Spring (Boot) provides. It should be as easy and convinent to write benchmarks as it is to write tests.

TL;DR;

@VesperDev
VesperDev / RouterApp.js
Last active July 14, 2024 11:50
Sider menu + ant-design + react-router-dom
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Layout, Menu, Icon } from 'antd';
import Dashboard from './containers/Dashboard/Dashboard';
import Meseros from './containers/Meseros/Meseros';
const { Header, Content, Footer, Sider } = Layout;
const SubMenu = Menu.SubMenu;
@Kruemelkatze
Kruemelkatze / ! Theming Ant Design with Sass and Webpack.md
Last active June 4, 2024 21:55
Theming Ant Design with Sass and Webpack

Theming Ant Design with Sass and Webpack

This is a solution on how to theme/customize Ant Design (which is written in Less) with Sass and webpack. Ant itself offers two solutions and a related article on theming, but these are only applicable if you use Less, the antd-init boilerplate or dva-cli.

What this solution offers:

  • use a single sass-file to customize (no duplicate variables for your project and Ant)
  • hot reload compatibility
  • no dependencies on outdated npm modules
  • easy integration with your existing webpack setup (webpack 3+ tested)
@mariocesar
mariocesar / api.js
Created September 26, 2017 04:21
Axios single configured instance
import axios from "axios";
const singleton = Symbol();
const singletonEnforcer = Symbol();
function readCookie(name) {
const match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
return (match ? decodeURIComponent(match[3]) : null);
}
@newswim
newswim / antd_sc_example.js
Created August 4, 2017 22:42
Wrapping Ant Design components with Styled Components
import { Link } from 'react-router-dom'
import { Badge, Col, Menu } from 'antd'
const StyledBadge = styled(Badge)`
.ant-badge-count {
background-color: #7ECBBF;
color: white;
box-shadow: 0 0 0 1px #d9d9d9 inset;
}
`
@balupton
balupton / next.config.js
Created February 3, 2017 16:00
next.js webpack configs
module.exports = {
webpack: (config) => {
const webpack = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
config.plugins = config.plugins || []
config.plugins.push(new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/))
config.plugins.push(new BundleAnalyzerPlugin())
return config
}
}
@aloisdg
aloisdg / scrap.ts
Created September 10, 2016 11:57
A tiny scrapper made with TypeScript and Cheerio
// https://www.codementor.io/nodejs/tutorial/how-to-write-a-web-scraper-in-nodejs
const cheerioReq = require("cheerio-req")
const fs = require('fs')
class Career { // secteur professionnel
name: string // private set
jobs: string[] // private set
constructor(name: string) {
this.name = name