Skip to content

Instantly share code, notes, and snippets.

View bacalj's full-sized avatar
🤔

Joseph Bacal bacalj

🤔
View GitHub Profile
@bacalj
bacalj / acf-to-vue-via-wp-rest-api.js
Last active April 4, 2019 19:10
Example - using vue to pull in and render images and text via wp rest api and acf
/*- - (in router.js) - - */
routes: [
...
{
path: '/:which',
name: 'home',
component: Home
}
@bacalj
bacalj / chrometabs.js
Last active October 6, 2019 21:09
open chrome tabs with JXA
/* create chrome instance */
chrome = Application("Google Chrome");
chrome.includeStandardAdditions = true;
/* make a new window and set its first tab */
win = chrome.Window().make();
win.tabs[0].url = "http://www.google.com";
/* make a new tab and push it into window we made */
tab = win.tabs.push(new chrome.Tab());
@bacalj
bacalj / twochromewindows.js
Created October 6, 2019 21:12
Open links in two different chrome windows
/* create chrome instance */
chrome = Application("Google Chrome");
chrome.includeStandardAdditions = true;
/* grab the window automatically created and set the url of its first tab */
chrome.windows.byId(1).tabs[0].url = "http://classroom.google.com";
/* make a new window and set its first tab */
win = chrome.Window().make();
win.tabs[0].url = "http://www.challengegalaxy.com";
@bacalj
bacalj / main.dart
Last active November 30, 2019 14:34
This flutter app from the Google tutorial works but I need to grok it, man
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
/* entry point to all flutterland is main, I think */
void main() => runApp(MyApp());
/*
-- CREATE THE APP INSTANCE AS A UBER-WIDGET --
subclass StatelessWidget to create an object to hold the app
*/
@bacalj
bacalj / hellocrowd.dart
Created December 17, 2019 16:37
some basic dart stuff
void sayHi( String someText){
print('Hi, $someText');
}
void hiToCrowd( List theCrowd ){
for (var fella in theCrowd){
sayHi(fella);
}
}
@bacalj
bacalj / dartinout.dart
Created December 17, 2019 17:40
getting input old timey way in dart
import 'dart:io';
void main() {
stdout.writeln('who r u?');
String input = stdin.readLineSync();
return respondo(input);
}
void respondo(String responso){
print('Hello, $responso');
@bacalj
bacalj / soy.dart
Created December 22, 2019 01:55
Defies description, by definition
void soy(){
print("I am that I am");
}
void main() {
soy();
}
@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() {
@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 / 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