Skip to content

Instantly share code, notes, and snippets.

@michoelchaikin
michoelchaikin / python_suiteql.py
Created June 22, 2021 00:16
Run NetSuite SuiteQL queries using REST API in python
import requests
import json
import pandas as pd
import os
from oauthlib import oauth1
from requests_oauthlib import OAuth1Session
def parse_suiteql_response(response):
response_json = json.loads(response.text)
@prestancedesign
prestancedesign / web.clj
Last active July 2, 2024 23:03
Ring session authentication with Reitit
(ns authexample.web
(:gen-class)
(:require [buddy.auth :refer [authenticated? throw-unauthorized]]
[buddy.auth.backends.session :refer [session-backend]]
[buddy.auth.middleware :refer [wrap-authentication wrap-authorization]]
[clojure.java.io :as io]
[compojure.response :refer [render]]
[reitit.ring :as ring]
[ring.adapter.jetty :as jetty]
[ring.middleware.params :refer [wrap-params]]
@benkoshy
benkoshy / elm-drag-and-drop-with-sha.md
Last active July 20, 2024 03:49
An Elm drag and drop example - where the SHA1 of files are calculated

https://ellie-app.com/98sGDxNXbpTa1

module Main exposing (..)
import Browser
import Bytes exposing (Bytes)
import Bytes.Encode as Encode
import File exposing (File)
import File.Select as Select
import Html exposing (..)
@saukap
saukap / pan-responder.cljs
Last active July 31, 2023 14:06
Using PanResponder from clojurescript
(def pan-responder (.-PanResponder react-native))
(defn cirlce
[circle-radius]
(let [radius circle-radius
*pan (atom nil)]
(r/create-class
{:component-did-mount
#(debug "Component mounted..")
:component-will-mount

Open the REPL and import some stuff:

Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_131).
Type in expressions for evaluation. Or try :help.

scala> import scala.concurrent._, duration._, ExecutionContext.Implicits.global
import scala.concurrent._
import duration._
import ExecutionContext.Implicits.global
module Collapse exposing (..)
import Html exposing (Html, text, div, button)
import Html.Attributes exposing (class, style)
import Html.Events exposing (onClick)
import Maybe exposing (withDefault)
-- MODEL
@espeed
espeed / binary16-uuid.clj
Last active July 3, 2024 02:09
Random UUID compressed into a Binary 16 byte array in Clojure.
;; Random UUID compressed into a Binary 16 byte array in Clojure.
;; by James Thornton, http://jamesthornton.com
(ns espeed.uuid
(require [clojure.data.codec.base64 :as b64]))
(defn uuid4 [] (java.util.UUID/randomUUID))
(defn uuid-as-byte-array []