Skip to content

Instantly share code, notes, and snippets.

View bacalj's full-sized avatar
🤔

Joseph Bacal bacalj

🤔
View GitHub Profile
@bacalj
bacalj / artLogicImport.js
Last active May 17, 2022 01:52
import from artlogic to sanity - WIP
import {
getArtistIdMap,
getFeedItems,
createDocsFromItems
} from './artistUtils'
let artistIdsMap;
let feedItems;
let startingIndex;
let endingIndex;
@bacalj
bacalj / send-email.js
Created April 2, 2022 18:32
Netlify's Example Nodemailer Function, thanks Netlify CLI
// with thanks to https://github.com/Urigo/graphql-modules/blob/8cb2fd7d9938a856f83e4eee2081384533771904/website/lambda/contact.js
const process = require('process')
const { promisify } = require('util')
const sendMailLib = require('sendmail')
const { validateEmail, validateLength } = require('./validations')
const sendMail = promisify(sendMailLib())
@bacalj
bacalj / sanity-create.js
Created October 30, 2021 01:29
Example netlify function writing to sanity - taken right from what CLI generates
const process = require('process')
const sanityClient = require('@sanity/client')
// You will need to configure environment variables for Sanity.io project id,
// dataset name, and a token with write access. The variables are named
//
// SANITY_PROJECTID
// SANITY_DATASET
// SANITY_TOKEN
@bacalj
bacalj / author.js
Created July 25, 2021 15:15
The blog schema that comes in the Sanity.io blog template, for reference
export default {
name: 'author',
title: 'Author',
type: 'document',
fields: [
{
name: 'name',
title: 'Name',
type: 'string',
},
@bacalj
bacalj / example_merge.gs
Last active December 18, 2020 15:06
A basic way to create docs based on google sheet data
/* grab objects for data, template, and target folder */
MY_VALUES = SpreadsheetApp.getActiveSpreadsheet().getRange('replace_this_string_with_range_in_A1_notation').getValues();
MY_TEMPLATE = DriveApp.getFileById('replace_this_string_with_fileid');
MY_FOLDER = DriveApp.getFolderById('replace_this_string_with_folderid');
/* timestamp function */
function niceStamp(){
return Utilities.formatDate(new Date(), "GMT-4", "MM-dd-yy ' at ' HH:mm:ss ");
}
@bacalj
bacalj / blogfournotes.md
Last active November 17, 2020 12:54
Phoenix Blog Iteration Number Four

Notes

1. Make the app

$ mix phx.new blogfour
$ cd blogfour
$ mix ecto.create
$ mix phx.server
@bacalj
bacalj / raisinsaregross.exs
Created October 22, 2020 18:00
pattern matching the function input
defmodule Food do
def test_food(%{ name: "raisins"} = food) do
"The food is tiny, gross #{food.name}. It tastes #{food.taste}."
end
def test_food(food) do
"The food is #{food.name}. It tastes #{food.taste}."
end
end
@bacalj
bacalj / google_meta_data_for_your_django_detail.py
Created May 26, 2020 02:12
Using Gspread in Django View To Access Google Sheets Data
import gspread
from oauth2client.service_account import ServiceAccountCredentials
from .models import Student
class StudentDetailView(DetailView):
model = Student
template_name = 'student_detail.html'
def get_context_data(self, *args, **kwargs):
@bacalj
bacalj / Car.dart
Created December 23, 2019 01:49
dartclass2
class Car{
int wheels = 4;
String modelName;
Car( {String givenModelName} ){
modelName = givenModelName;
}
}
void main() {