Skip to content

Instantly share code, notes, and snippets.

@dannysperry
dannysperry / gist:5987997
Created July 12, 2013 21:26
Javascript examples from questions.js in my quiz repo
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
};
var questions = function() {
// clear all, if any, questions within .QUESTION
$('.question').html('');
// create each question form and append to .QUESTION
$.each(allQuestions, function(i){
// create html for individual questions and choices
# Helper Class that takes binary numbers as a string literal
class BinaryString
HEX_HASH = { 10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f' }
attr_accessor :val
def initialize(val)
@val = val.to_s(2)
end
@dannysperry
dannysperry / string-comparison.rb
Last active September 8, 2017 19:22
String Comparing Exercise
#!/usr/bin/env ruby
require 'minitest'
require 'minitest/spec'
require 'minitest/autorun'
require 'pry-byebug'
# Hi! We have a challenge for you to complete.
#
# We've defined the differences between two strings to be the number of
# characters that don't match. For example, "bob" and "rob" are mostly the same
@dannysperry
dannysperry / initialize_and_connect_methods
Last active December 10, 2023 09:54
PPPP_Read debugging
read_size = FFI::MemoryPointer.new(:int32, 1)
read_size.write_int32(4)
p2p_buffer_size = 128 * 1024
input_buffer = FFI::MemoryPointer.new(:char, p2p_buffer_size, true)
some_obj = SandBox.new.authenticate read_size, input_buffer, 100000
class SandBox
def authenticate(read_size, input_buffer, timeout=100000)
A binary tree is a tree of Nodes where every node has a value and up to two children Nodes.
The children Nodes can be called @left and @right, @first and @last, or something similar
Perfect Binary Tree - If a tree of nodes has no empty node spaces on all it's levels
They contain a value
They can refer to another node to the left with a smaller value
They can refer to another node to the right with a larger value
@dannysperry
dannysperry / 1 Fullstack Skills List
Last active October 31, 2018 02:36
I've set up a skill list to specify required skills related to full-stack web development. This is a growing list that is intended to identify skills I've learned and need to learn.
I've set up a skill list to specify required skills related to full-stack web development. This is a growing list that is intended to identify skills I've learned and need to learn.
The basic to moderate skills needed are:
- git
- SSH
- HTTP, HTTP/2, & APIs
- Terminal Usage
- Research Skills with search engines and documentation
- Data Structures & Algorithms