Skip to content

Instantly share code, notes, and snippets.

@bbatsche
bbatsche / Icu4c@64.rb
Last active December 8, 2021 17:04
Homebrew formula to install Icu4c pinned at version 64
class Icu4cAT64 < Formula
desc "C/C++ and Java libraries for Unicode and globalization"
homepage "http://site.icu-project.org/home"
url "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-src.tgz"
version "64.2"
sha256 "627d5d8478e6d96fc8c90fed4851239079a561a6a8b9e48b0892f24e82d31d6c"
keg_only :versioned_formula
def install

PHP Crash Course

  • All code goes inside of PHP tags:

    <?php
    // code goes here
    ?>
  • Note, this is not an HTML tag; there is no closing tag to go along with it. Your PHP code will literally go between the ?s

Exercise 1

  • Make a wave of boxes. (Similar to visible spectrum exercise, but comes back in and out).
  • It should hold the lines of a poem. Any poem. Songs work too.
  • Make it look nice. Matching color scheme (practice good design principles - no more than 5 colors per page.)
  • The text should be centered inside the box using padding.

Examples / Inspiration

  1. Pinterest

Create migration

  • db: users
  • table: contacts
    • id
    • email
    • name
    • phone
    • address
    • city
    • state
1. Find the name of all departments currently managed by women.
Department Name | Manager Name
----------------+-----------------
Development | Leon DasSarma
Finance | Isamu Legleitner
Human Resources | Karsetn Sigstam
Research | Hilary Kambil
2. Find the current titles of employees currently working in the Customer Service department.
Title | Count
extendedPWD() {
pwd_length=25
((pwd_length2=$pwd_length + 2))
((pwd_length3=$pwd_length - 2))
DIR=`pwd`
echo $DIR | grep "^$HOME" >> /dev/null
if [ $? -eq 0 ]; then
CURRDIR=`echo $DIR | awk -F$HOME '{print $2}'`
"use strict";
var Hangman = {
words: [], // Set of words for hangman to choose from
currentWord: '', // Current word for the game
correctGuesses: [], // Correct letters the user has guesses
incorrectGuesses: [], // Wrong letters the user has guessed
maxGuesses: 0, // Maximum number of wrong guesses the user is allowed
/**
@bbatsche
bbatsche / Model.php
Created September 29, 2015 20:06
Haversine Query Scope
<?php
class BaseModel {
const UNIT_KM = 111.045;
const UNIT_MI = 69.0;
// Throw this function in any model with latitude/longitude columns
// Or if multiple models have those values you can put it in your BaseModel
public function scopeNearLatLong($query, $lat, $lng, $radius = 10, $unit = 69.0)
{
@bbatsche
bbatsche / README.md
Created September 10, 2015 14:53
How to use a custom Angular filter with Moment.js to parse and display dates from PHP

When a PHP DateTime (or Carbon date) object is converted to JSON it is sent in a format that native JavaScript cannot parse, like this:

{
  "date": "2015-09-10 14:09:46",
  "timezone_type": 3,
  "timezone": "UTC"
}
@bbatsche
bbatsche / PostsController.php
Last active January 27, 2016 20:32
Angular 1.4 + Laravel 4.2
<?php
// app/controllers/PostsController.php
class PostsController extends \BaseController
{
// ...
public function destroy($id)
{
// ...