Skip to content

Instantly share code, notes, and snippets.

View lgersman's full-sized avatar
💭
Stecke voller Bratentang 💪

lars.gersmann lgersman

💭
Stecke voller Bratentang 💪
View GitHub Profile
from operator import itemgetter
from langchain.chat_models import ChatOpenAI
from langchain.embeddings import OpenAIEmbeddings
from langchain.schema import StrOutputParser
from langchain.schema.runnable import RunnablePassthrough, RunnableMap
from langchain.vectorstores import Chroma
from langchain.prompts import PromptTemplate
from langchain.document_loaders import JSONLoader
from dotenv import load_dotenv
#!/usr/bin/env bash
# Script will open up fzf to select a monorepo package and show the git commit log for that monorepo package.
# (Start the script in your monorepo root directory)
# Requires:
# - git
# - pnpm
# - fzf >= 0.29.0
#
# Author: Lars Gersmann <lars.gersmann@gmail.com>
@lgersman
lgersman / rollup.config.js
Created October 16, 2019 10:27
rollup config for a wordpress plugin including scss/es2018 support
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
//import strip from 'rollup-plugin-strip';
import scss from 'rollup-plugin-scss';
import packageJson from './package.json';
import babel from 'rollup-plugin-babel';
import { terser } from 'rollup-plugin-terser';
const createBrowserConfig = (customizeConfig = () => {}) => {
const config =
@lgersman
lgersman / README.md
Last active February 2, 2020 00:18 — forked from anonymous/README.md
improved state diagram editor based on https://gist.github.com/lgersman/5311202 featuring curvy connections with helper points

new features

  • css improved
  • css transitions added

nodes

  • double click on a node to remove it
@lgersman
lgersman / README.md
Last active July 2, 2021 03:41
state diagram editor example based on (https://gist.github.com/lgersman/5311083)
  • Click into the drawing area to start the selection frame
  • move the mouse to resize the selection frame
  • Release the mouse button to resize the selection frame
  • circles are draggable
  • circles can be selected (multiple selections possible by pressing CTRL while clicking a circle)
  • the selection frame selects all circles within the frame (by pressing CTRL the selected circles will be appended to current selection)
  • multiple selected circles will be dragged simultaneous

new features:

@lgersman
lgersman / README.md
Last active October 19, 2022 12:15
improved version of my d3.js selection frame example (https://gist.github.com/lgersman/5310854) supporting draggable/selectable nodes
  • Click into the drawing area to start the selection frame
  • move the mouse to resize the selection frame
  • Release the mouse button to resize the selection frame

new features :

  • circles are draggable
  • circles can be selected (multiple selections possible by pressing CTRL while clicking a circle)
  • the selection frame selects all circles within the frame (by pressing CTRL the selected circles will be appended to current selection)
  • multiple selected circles will be dragged simultaneous
@lgersman
lgersman / README.md
Last active August 3, 2019 13:43
d3.js selection frame example.
  • Click into the drawing area to start the selection frame
  • move the mouse to resize the selection frame
  • Release the mouse button to resize the selection frame

(The circles are just for illustrating purposes)

See it live : http://bl.ocks.org/lgersman/5310854

@lgersman
lgersman / jquery_ajax_file_upload.js
Created September 20, 2012 09:43
basic jquery.upload.js usage example
/*
* track file upload progress using the Deferred returned from the $.ajax call.
*
* See https://github.com/lgersman/jquery.orangevolt-ampere/blob/master/public/lib/ampere/jquery.upload.js
*/
$.upload( form.action, new FormData( myForm))
.progress( function( progressEvent, upload) {
if( progressEvent.lengthComputable) {
var percent = Math.round( progressEvent.loaded * 100 / progressEvent.total) + '%';
if( upload) {
@lgersman
lgersman / jquery_ajax_file_upload_3.js
Created September 17, 2012 14:35
query.upload.js usage example using local progress event handler
/*
* track file upload progress using local progress event handler.
*
* See https://github.com/lgersman/jquery.orangevolt-ampere/blob/master/public/lib/ampere/jquery.upload.js
*/
$.ajax({
processData : false,
contentType : false,
data : new FormData( myForm),
type : 'POST',
@lgersman
lgersman / jquery_ajax_file_upload_2.js
Created September 17, 2012 14:31
jquery.upload.js usage example using global progress event handler
/*
* track file upload progress using global progress event handler.
*
* See https://github.com/lgersman/jquery.orangevolt-ampere/blob/master/public/lib/ampere/jquery.upload.js
*/
$( document).on( 'ajaxProgress', function( jqEvent, progressEvent, upload, jqXHR) {
if( progressEvent.lengthComputable) {
var percent = Math.round( progressEvent.loaded * 100 / progressEvent.total) + '%';
if( upload) {