Skip to content

Instantly share code, notes, and snippets.

View ndimatteo's full-sized avatar
💀
Imposter Syndrome

Nick DiMatteo ndimatteo

💀
Imposter Syndrome
View GitHub Profile
@ndimatteo
ndimatteo / !Beyond Dark Mode.md
Last active October 7, 2022 18:02
Beyond Dark Mode
@ndimatteo
ndimatteo / !Advanced Link Component.md
Last active March 28, 2024 04:31
Advanced Link Component for Next.js
@ndimatteo
ndimatteo / _Sanity - Async Conditional Fields.md
Last active June 22, 2021 13:33
Sanity Conditional Fields (async)

Async Conditional Fields for Sanity

✨ Asynchronous ✨ multiple fields ✨ Sanity UI ✨ Easy! ✨

Show multiple fields in an object field, based on a condition set through the "options" object. Simply return true/false from "condition" function, even asynchronously!

remote: npm ERR! install Couldn't read dependencies
remote: npm ERR! Error: ENOENT, open '/var/sites/twentyoverten.com/templates/t1/package.json'
remote: npm ERR! If you need help, you may report this log at:
remote: npm ERR! <http://github.com/isaacs/npm/issues>
remote: npm ERR! or email it to:
remote: npm ERR! <npm-@googlegroups.com>
remote:
remote: npm ERR! System Linux 3.2.0-23-virtual
remote: npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
remote: npm ERR! cwd /var/sites/twentyoverten.com/templates/t1
$('.add-coupon').each(function() {
$(this).click(function() {
var couponVal = $('.coupon', this).val();
$('span', this).text('Applying');
$.getJSON('/check-coupon', {
coupon: couponVal
}, function(data) {
// Invalid
if (!data.valid) {
@ndimatteo
ndimatteo / 4.js
Last active January 2, 2016 01:19
app.get('/check-coupon', function(req, res, next) {
stripe.coupons.retrieve(req.body.coupon, function(err, coupon) {
if (err) return res.json({ valid: false });
res.json({ valid: true });
})
})
/*-----Scaffolding-----*/
.header {
background: #2d2d2d;
}
.content {
background: #2d2d2d;
}