This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; 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"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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])))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.className { background: red; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) |
NewerOlder