Skip to content

Instantly share code, notes, and snippets.

View danielpclark's full-sized avatar
💼
Open to new opportunities.

Daniel P. Clark danielpclark

💼
Open to new opportunities.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am danielpclark on github.
  • I am danielpclark (https://keybase.io/danielpclark) on keybase.
  • I have a public key whose fingerprint is 956B A9E5 AE97 55EA FAFA 4923 83D1 9EA4 79E5 7E78

To claim this, I am signing this object:

function fish_prompt
if not set -q -g __fish_robbyrussell_functions_defined
set -g __fish_robbyrussell_functions_defined
function _git_branch_name
echo (git rev-parse --abbrev-ref HEAD ^/dev/null)
end
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
end
# I realize the mistake. I wanted to run global state change once
# but the setup method runs for every test
require 'minitest/autorun'
class A
def self.toggle_informant
@informant = !@informant
end
def informant?
@danielpclark
danielpclark / El-Shaddai.crd
Last active July 15, 2016 05:10
Verse and chorus tablature for El Shaddai. Violin / Guitar / Bass
El Shaddai - Michael Card (cover)
Arrangement by: Daniel P. Clark
[V]iolin / [G]uitar / [B]ass
Note: The tabs aren't the exact quantity of notes played. They are the primary
notes in transitions. You may play written notes more than once to fill
in the appropriate rhythm.
[V]
E |---------------------------------------------------------------|
A |---------------0-----------------------------------------------|
#!/usr/bin/env ruby
require 'neatjson'
@hash = {}
begin
loop do
sleep 15
x = `xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) _NET_WM_NAME`
x = x.match(/.*\"(.*)\"\n\z/)[1][0..60]
@hash[x] = @hash[x].to_f + 0.25
@danielpclark
danielpclark / hex.rb
Created April 18, 2016 21:45
Methods for verifying a hexadecimal string and ensuring its length.
module Hex
class << self
def is_hex? str
str[/\h*/i] == str
end
def hex str
return str if is_hex?(str)
str.unpack("H*").first
end
class SingletonClass
# Remove external access to the new method
private_class_method :new
def initialize
puts "SingletonClass initializer"
end
# Rename the new method as create
def self.create(*args, &block)
@danielpclark
danielpclark / uncors.rb
Created March 28, 2016 02:47
Theory example of bypassing CORS
# How to hide cross site scripting. Make it appear local.
# You could even redirect all requests from said scripts
# through the same cgi script if you choose to implement it.
require 'open-uri'
require 'cgi'
cgi = CGI. new
cgi.out { open(cgi["url"]).read } # url is a given parameter that will fetch other site and return it as local

This is my ideal design in Minitest

require 'test_helper'
describe "Thing" do
  let(:cow) { Array.new }

  it "does the thing" do
    _(cow.length).must_be :<, 3
@danielpclark
danielpclark / number_types.rb
Created December 7, 2015 03:46
A snippet example of the use of Boolean recognition and identification in Ruby.
module NumberTypes
NumFlags = Struct.new :bytewidth, :min_val, :max_val,
:rb_type, :name, :packer_type
module ::Boolean; end
class ::FalseClass
prepend Boolean
def to_i; 0b0 end
end