Skip to content

Instantly share code, notes, and snippets.

View bacalj's full-sized avatar
🤔

Joseph Bacal bacalj

🤔
View GitHub Profile
@bacalj
bacalj / blackjack_working_part.rb
Created July 4, 2013 01:35
Doing this in a weird way. Face cards not calculating. Advice?
# this "works", but face cards don't calculate.
# this is not 'elegant'
suits = [' of Diamonds' , ' of Hearts', ' of Clubs', ' of Spades']
values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K' ]
deck = []
deck = values.product(suits)
deck.shuffle!
player = []
suits = [' of Diamonds' , ' of Hearts', ' of Clubs', ' of Spades']
values = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K' ]
deck = []
deck = values.product(suits)
deck.shuffle!
player = []
dealer = []
2.times do
@bacalj
bacalj / gist:11344932
Last active August 29, 2015 14:00
Exercise 5 of NodeSchool.io Learnyounode
//The code below passes the test - just writing down the process and a lingering question...
//First I had it testing for a hard-coded '.md' - that passed, but
//It only passed because the test happened to be wrriten for .md (?)
//then I put the second command line argument in as the test process.argv[3]
//but that didn't work
//saw the solution after passing the test and it had the addition of a '.'
//did the same to mine, and it now passes
//inspected process.argv[3] and it was indeed '.txt'
//Sooooo - why the need for the '.'? Regular expression trick?
@bacalj
bacalj / gist:a1cf2c51473f1b4077ac
Last active August 29, 2015 14:08
set up a repeater field to end up in bootstrap tabs
<div id="main-container" class="section">
<div class="main-body container">
<div class="row">
<div class="post-content col-md-10">
<?php if (have_posts()) : while(have_posts()) :the_post();?>
<div class="post-single" id="post-<?php the_ID(); ?>">
<div class="post-body">
<?php the_content();
@bacalj
bacalj / gist:18dac320b5d32b249207
Last active May 22, 2018 23:03
getting acf repeater into bootstrap tabs
<?php if (have_posts()) : while(have_posts()) :the_post();?>
<div class="post-single" id="post-<?php the_ID(); ?>">
<div class="post-body">
<!-- START CONTENT -->
<?php the_content();
//if there are tabs - open up a tabset ul
if( get_field('tab') ) {
echo ('<ul class="nav nav-tabs" role="tablist">');
@bacalj
bacalj / config.rb
Created November 19, 2014 15:52
basic compass config what works with wordpress desired style.css
#
# This file is only needed for Compass/Sass integration. If you are not using
# Compass, you may safely ignore or delete this file.
#
# If you'd like to learn more about Sass and Compass, see the sass/README.txt
# file for more information.
#
# Remember - sass dir has style.scss, and theme dir has style.css for this
#
#
@bacalj
bacalj / index.html
Created October 6, 2015 03:43
pjPNEj
<h1>Welcome to the Quiz!</h1>
<p>Click each question to get the answer.</p>
<div class="panel">
<div class="question">What does HTML do?</div>
<div class="answer">Hyper Text Markup Language makes stuff exist on the page</div>
</div>
<div class="panel">
<div class="question">What does CSS do?</div>
@bacalj
bacalj / courses_with_annotation_feedback.sql
Last active July 29, 2016 13:46
Moodle courses that have used inline PDF annotation feedback -thanks, mackensen
SELECT DISTINCT name as "Assignment Name", course as "Course ID", fullname as "course title", "Standard" as "Annotation"
FROM prefix_assignfeedback_editpdf_annot ant
INNER JOIN prefix_assign_grades grd ON ant.gradeid = grd.id
INNER JOIN prefix_assign assign ON grd.assignment = assign.id
INNER JOIN prefix_course c ON assign.course = c.id
UNION
SELECT DISTINCT name as "Assignment Name", course as "Course ID", fullname as "course title", "Comment" as "Annotation"
FROM prefix_assignfeedback_editpdf_cmnt cmnt
INNER JOIN prefix_assign_grades grd ON cmnt.gradeid = grd.id
INNER JOIN prefix_assign assign ON grd.assignment = assign.id
@bacalj
bacalj / simple_sign_up_message.php
Created December 15, 2016 00:28
Ultra-simple example of using a filter to write a basic WordPress plugin
<?php
/*
Plugin Name: Sign Up Message
Description: A basic plugin for illustration/learning purposes. Thanks subscribers at the end of a post. Not logged in users get asked to sign up.
Version: 0.1
Author URI: http://www.digitalblockarea.com
*/
function simple_sign_up_message($content){
const fs = require('fs');
const xml2js = require('xml2js');
const util = require('util');
const eyes = require('eyes');
const converter = require('json-2-csv');
const parser = new xml2js.Parser();
//const xml = fs.readFileSync('just_notes.xml', 'utf8');
const inspect = require('eyes').inspector({maxLength: false});