Skip to content

Instantly share code, notes, and snippets.

View andreortiz82's full-sized avatar
🎯
Focusing

Andre Ortiz andreortiz82

🎯
Focusing
View GitHub Profile
@andreortiz82
andreortiz82 / flatten.py
Created March 11, 2024 02:36
evaluates, copies, flatten, and renames my sample files
import os
import shutil
import re
def sanitize_filename(filename):
"""
Sanitizes the filename to ensure it contains only alphanumeric characters and underscores,
replacing any special characters with underscores. Preserves the file extension.
"""
# Separate the extension and the name
// Atomic CSS
// Small, immutable and explicitly named utility classes.
.bg-red5 { backgound: $red5; }
.text-align-center { text-align: center; }
.padding-bottom-xl { padding-bottom: #{$size-xl}px; }
@andreortiz82
andreortiz82 / demo.cljs
Created December 9, 2020 21:50
Render List from API response
(ns demo.core
"Basic Example."
(:require [reagent.core :as r :refer [atom]]
[ajax.core :refer [GET]]
["picasso-pkg" :refer [Card List List.Item message.error]]))
; - This is global and be accessed from inside/outside this Namespace
(def app-state (atom {:posts []}))
; - Error Handler
;; Basic boilerplate helpers for the common man.
;; Defining data
;; Vector is a collection
;; With Vectors, I can generate lists in my UI
(def my-vector [])
;; Maps are a Key / Value object
(def my-map {:name "Julian" :location "PDX"})
(def some-data
[{:id :fruits
:title "Fruits"
:types [{:id :apple :title "Apple"}
{:id :orange :title "Orange"}
{:id :banana :title "Banana"}]}
{:id :vegetables
:title "Vegetables"
:types [{:id :tomato :title "Tomato"}
{:id :carrot :title "Carrot"}
(ns gallery.prototypes.trialboard
(:require [cljsjs.react-beautiful-dnd]
[rum.core :as rum]))
(def drag-drop-context
(.createFactory js/React (.-DragDropContext js/ReactBeautifulDnd)))
(def droppable
(.createFactory js/React (.-Droppable js/ReactBeautifulDnd)))
@andreortiz82
andreortiz82 / app.cljs
Created February 26, 2019 02:17
Quick tooltip spike
(defn tooltip-handler
"This method listens for mouse over/out events and injects the DOM with an HTML element"
[{:keys [data]} event]
(let [position (-> event .-target .getBoundingClientRect)
width (.-width position)
height (.-height position)
x (+ (.-left position) 20)
y (.-top position)
output data]
(if-not (= data nil)
@andreortiz82
andreortiz82 / url-param.cljs
Created January 9, 2019 16:39 — forked from kordano/url-param.cljs
URL parameter parsing with clojurescript
(defn parse-params
"Parse URL parameters into a hashmap"
[]
(let [param-strs (-> (.-location js/window) (split #"\?") last (split #"\&"))]
(into {} (for [[k v] (map #(split % #"=") param-strs)]
[(keyword k) v]))))
.className { background: red; }
task :deploy do
require "aws-sdk"
Aws.config.update({
region: 'us-east-1',
credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'])
})
s3 = Aws::S3::Resource.new
bucket = s3.bucket(ENV['AWS_BUCKET'])