Skip to content

Instantly share code, notes, and snippets.

-- H.Zimmerman, AppleScript.
-- Create text file in current Finder folder with a dialog.
tell application "Finder"
try
display dialog "name of doc please (without the .txt thing)" default answer ""
set fileName to the text returned of result
if length of fileName = 0 then
return 0
tell application "Finder"
try
set fileName to "eeee"
if length of fileName = 0 then
return 0
end if
set fileExt to "txt"
set thisFolder to "Macintosh HD⁩:Users:csilverman:Dropbox:⁨dev:Local Sites:csiprojects:app:public:playlists:assets:links"
-- the target of the front window as alias
var discreteElements = document.getElementsByClassName('animate-this')
for (var i = 0; i < discreteElements.length; i++) {
new Waypoint({
element: discreteElements[i],
handler: function() {
this.element.classList.add("top-50pfrom-topOfWindow");
},
// context: document.getElementById('page-content'),
offset: '50%'
});
@csilverman
csilverman / array-iteration.php
Created September 5, 2020 23:30
Iterate over arrays
<?php
foreach ($array as &$item) {
// code
}
unset($item);
foreach ($array as $key => $value) {
// code
}
@csilverman
csilverman / newfolder.scpt
Created January 16, 2021 22:24
Create new folder on desktop
tell application "Finder"
set p to path to desktop -- Or whatever path you want
make new folder at p with properties {name:"New Folder"}
end tell
@csilverman
csilverman / _visually-hidden.css
Created April 28, 2021 17:11
Accessibly hide text
.visually-hidden {
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
}
var discreteElements = document.getElementsByClassName('sticky-frame')
for (var i = 0; i < discreteElements.length; i++) {
new Waypoint({
element: discreteElements[i],
handler: function(direction) {
if ( direction == 'down' )
this.element.classList.add('stuck');
else
this.element.classList.remove('stuck');
},
details {
summary {
list-style: none;
&::marker,
&::-webkit-details-marker {
display:none;
}
}
}
:root {
--burgundy-light: #951829;
--gray-light: #d7cfcc;
--gray-xxxlight: #f7f5f1;
--gray-xxxlight-border: 1px solid rgba(212, 204, 202, 0.3);
--gray-charcoal: #222;
--gold: #C6AA76;
/// Rem output with px fallback.
///
/// @group Typography
/// @author Adam Laki
///
/// @param {Number} $sizeValue - Element's font size
/// @output `font-size` with fallback
///
/// @example scss - Set rem font-size to `.foo`
/// .foo {