Skip to content

Instantly share code, notes, and snippets.

@tudorels
tudorels / gist:d0b1e79bc2dad5aa4782508d4e760af8
Created October 4, 2023 10:56 — forked from neumino/gist:6554108
Filtering nested arrays with RethinkDB
r.table("test").filter( function(doc) {
return doc("adresses").contains(function(adress) {
return adress("city").eq("Paris")
})
})
/*
{
@Vishal-Isharani
Vishal-Isharani / historyState.ts
Created July 6, 2022 10:17
Konva js Undo/Redo History
import Konva from 'konva';
import { ShapeConfig } from 'konva/lib/Shape';
export class HistoryStat {
private static _instance: HistoryStat;
public _currentStat: any[] = [];
private _currentPointer: number = -1;
private _history: Array<Object[]> = [];
@ap1969
ap1969 / snapsvg.vue
Created July 22, 2021 09:28
Using snap-svg in Vue 3
<template>
<q-page class="flex flex-center">
<div>
<svg id="svg" width="300" height="300"></svg>
</div>
<svg width="0" height="0">
<pattern
id="pattern"
patternUnits="userSpaceOnUse"
x="0"
@seblegall
seblegall / reverseproxy.go
Last active July 9, 2024 15:08
A reverse proxy in Golang using Gin
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"net/url"
"github.com/gin-gonic/gin"
)
@salmoni
salmoni / goQueryTest.go
Last active July 20, 2024 15:23
Parsing HTML in Go/Golang using goQuery to extract data from only one of multiple tables. Demonstrates nested Find statements.
package main
import (
"fmt"
"log"
"strings"
"github.com/PuerkitoBio/goquery"
)
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
Option "DRI" "3"
Option "AccelMethod" "uxa"
#Option "AccelMethod" "sna"
EndSection
@theorigin
theorigin / SQLServer-APIPost.sql
Last active January 9, 2024 12:10
SQL Server code to POST to an API
DECLARE @Object AS INT;
DECLARE @ResponseText AS VARCHAR(8000);
DECLARE @Body AS VARCHAR(8000) =
'{
"what": 1,
"ever": "you",
"need": "to send as the body"
}'
EXEC sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
@jahanson
jahanson / pasteimage.html
Created March 3, 2014 17:42
Paste image from clipboard to canvas. Convert to base64 image string.
<!DOCTYPE html>
<html>
<head>
<title>Paste Image</title>
<script type="text/javascript">
var imageObj = new Image();
window.onload = function() {
document.getElementById("pasteTarget").
addEventListener("paste", handlePaste);
var canvas = document.getElementById('canvasTarget');
@JalfResi
JalfResi / revprox.go
Last active June 18, 2024 18:29
Simple reverse proxy in Go
package main
import(
"log"
"net/url"
"net/http"
"net/http/httputil"
)
func main() {
@jstangroome
jstangroome / DecryptObject.sql
Created November 5, 2012 21:29
Decrypt encrypted SQL Server stored procedures.
-- Must connect to SQL Server using the Dedicate Admin Connection, eg "admin:localhost". Verified with SQL Server 2012.
-- Originally from Williams Orellana's blog: http://williamsorellana.org/2012/02/decrypt-sql-stored-procedures/
DECLARE @ObjectOwnerOrSchema NVARCHAR(128)
DECLARE @ObjectName NVARCHAR(128)
SET @ObjectOwnerOrSchema = 'dbo'
SET @ObjectName = 'PROCEDURE NAME HERE'
DECLARE @i INT