Skip to content

Instantly share code, notes, and snippets.

View nickmeehan's full-sized avatar

Nick Meehan nickmeehan

View GitHub Profile
@nickmeehan
nickmeehan / 0.2.1-boggle_class_from_methods.rb
Last active August 29, 2015 13:55 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1boggle class challenge
class BoggleBoard
def initialize(dice_grid)
@board = dice_grid
end
def create_word(*coords)
coords.map { |coord| @board[coord.first][coord.last] }.join("")
end
@nickmeehan
nickmeehan / jquery_example.html
Last active August 29, 2015 13:57 — forked from dbc-challenges/jquery_example.html
Intro to jQuery for Phase 0
<!DOCTYPE html>
<html>
<head>
<title>DOM manipulation with jQuery</title>
<!-- Add a link to jQuery CDN here script here -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery_example.js"></script>
</head>
@nickmeehan
nickmeehan / jasmine_test_methods.md
Last active August 29, 2015 14:01
Jasmine Testing Methods

Jasmine Testing Methods

Finding methods for Jasmine testing is a pain in the ass. So I found these. Enjoy!
  • toBe: represents the exact equality (===) operator.

  • toEqual: represents the regular equality (==) operator.

  • toMatch: calls the RegExp match() method behind the scenes to compare string data.

@nickmeehan
nickmeehan / created_at_formatting.rb
Created May 19, 2014 04:23
How to format created_at in Ruby!
%a - The abbreviated weekday name (''Sun'')
%A - The full weekday name (''Sunday'')
%b - The abbreviated month name (''Jan'')
%B - The full month name (''January'')
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%j - Day of the year (001..366)
%m - Month of the year (01..12)
@nickmeehan
nickmeehan / indexing.md
Created May 20, 2014 00:42
Links to Explanations on Indexing
navigator.geolocation.getCurrentPosition(function(position) {
console.log(position.coords.latitude, position.coords.longitude);
});
@nickmeehan
nickmeehan / rainforestqa.rb
Created June 23, 2014 19:00
RainforstQA Challenge Application
require 'httparty'
require 'json'
def handle_follow_response(response)
new_id = response["follow"].match(/\d+/)
append_to_url = "id=#{new_id}"
puts response
get_new_json_response(append_to_url)
end
@nickmeehan
nickmeehan / iPhoneActionSheetPresentation.swift
Last active October 11, 2016 19:51
iPhone ActionSheet Presentation
@IBAction func showDeleteActionSheet(_ sender: AnyObject) {
let alertController = UIAlertController(title: nil, message: "Alert message.", preferredStyle: .actionSheet)
let defaultAction = UIAlertAction(title: "Default", style: .default, handler: { (alert: UIAlertAction!) -> Void in
// Do some action here.
})
let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (alert: UIAlertAction!) -> Void in
// Do some destructive action here.
})
@nickmeehan
nickmeehan / iPadActionSheetPresentationBarButtonItemCasting.swift
Last active October 11, 2016 20:02
iPad ActionSheet Presentation - Bar Button Item Casting
@IBAction func showDeleteActionSheet(_ sender: AnyObject) {
let alertController = UIAlertController(title: nil, message: "Alert message.", preferredStyle: .actionSheet)
let defaultAction = UIAlertAction(title: "Default", style: .default, handler: { (alert: UIAlertAction!) -> Void in
// Do some action here.
})
let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (alert: UIAlertAction!) -> Void in
// Do some destructive action here.
})
@nickmeehan
nickmeehan / iPadActionSheetPresentationBarButtonItemNoCast.swift
Created October 11, 2016 20:08
iPad ActionSheet Presentation - Bar Button Item No Cast
@IBAction func showDeleteActionSheet(_ sender: UIBarButtonItem) {
let alertController = UIAlertController(title: nil, message: "Alert message.", preferredStyle: .actionSheet)
let defaultAction = UIAlertAction(title: "Default", style: .default, handler: { (alert: UIAlertAction!) -> Void in
// Do some action here.
})
let deleteAction = UIAlertAction(title: "Delete", style: .destructive, handler: { (alert: UIAlertAction!) -> Void in
// Do some destructive action here.
})