Skip to content

Instantly share code, notes, and snippets.

View awesome's full-sized avatar

So Awesome Man awesome

View GitHub Profile
@beneggett
beneggett / ruby-encryptor-exercise.md
Created September 24, 2013 22:26
Ruby Encryptor Exercise

Encryptor

Have you ever wanted to send a secret message?

The Plan

Today we use computers to mask messages every day. When you connect to a website that uses "https" in the address, it is running a special encoding on your transmissions that makes it very difficult for anyone to listen in between you and the server.

# for more info: https://gist.github.com/1120938
@bennadel
bennadel / client-to-client.cfm
Created August 13, 2013 13:58
Sending Client-To-Client Realtime Messages With Pusher App And ColdFusion
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>
Sending Client-To-Client Realtime Messages With Pusher App And ColdFusion
</title>
<link rel="stylesheet" type="text/css" href="./styles.css"></link>
# http://rubular.com/r/4DIAmT5J7U
# http://en.wikipedia.org/wiki/ZIP_code#ZIP.2B4
# multi-line string
# /^(\d{4,5}$)|(\d{5}-?\d{4}$)/
# single-line string
# /\A(\d{4,5}\z)|(\d{5}-?\d{4}\z)/
#ZIP CODE REGEXP by SoAwesomeMan
@timuruski
timuruski / test.rb
Created July 24, 2013 16:55
Trying to tease out STDIN/OUT interactivity for Ruby scripts
puts "STDIN: #{STDIN.tty?}, $stdin: #{$stdin.tty?}"
puts "STDOUT: #{STDOUT.tty?}, $stdout: #{$stdout.tty?}"
@bantic
bantic / rails_route_recognizer.rb
Last active September 9, 2022 12:22
Programmatically list all routes (/paths) from within a rails app.
class RouteRecognizer
attr_reader :paths
# To use this inside your app, call:
# `RouteRecognizer.new.initial_path_segments`
# This returns an array, e.g.: ['assets','blog','team','faq','users']
INITIAL_SEGMENT_REGEX = %r{^\/([^\/\(:]+)}
def initialize
@nichtich
nichtich / README.md
Last active February 20, 2025 12:34 — forked from oodavid/README.md
How to automatically deploy from GitHub

Deploy your site with git

This gist assumes:

  • you have an online remote repository (github / bitbucket etc.)
  • you have a local git repo
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by Apache
  • the Apache user is named www-data (may be apache on other systems)
@mattdenner
mattdenner / gist:4977805
Created February 18, 2013 14:28
Me attempting to get my head around monads.

My biggest problem with monads is that my brain can't grasp them, obviously! One of the issues I've got is that people teach them as part of a somewhat bigger context: they start showing how Option[T] works and then suddenly declare ''Option[T] is a monad''! Or worse, they talk about something completely unrelated in an attempt to give you some real world perspective onto them. It's not working for me and it might not be working for you; what I'll write here is to help me understand monads, and it probably won't work for you, but it might.

I'm going to start with an extremely simple case class and build it up from there:

final case class Holder[+T](value: T)

It's really simple in that it holds a value of a type T. One thing to realise is that case class in Scala automatically gives you a companion object for Holder[T] called Holder which gives you an apply method for creating instances. I'm going to make a similar object, which I'll abitrarily call HolderMonad, that will have

@mediocretes
mediocretes / gist:4668238
Created January 29, 2013 21:48
Verifying BrainTree webhooks with ruby
def verify
if params[:bt_challenge]
render :text => Braintree::WebhookNotification.verify(params[:bt_challenge])
else
head :unprocessable_entity
end
end
@awesome
awesome / .recipe
Created December 14, 2012 20:06 — forked from sowawa/.recipe
thumbnail: http://pds.exblog.jp/pds/1/201101/16/02/d0055302_13383029.jpg
video: http://www.youtube.com/watch?v=UE27t_LJpx0