Skip to content

Instantly share code, notes, and snippets.

View victorhazbun's full-sized avatar
🚀
Work work work

Victor Hazbun Anuff victorhazbun

🚀
Work work work
View GitHub Profile
@CatTail
CatTail / client.html
Created February 9, 2017 10:17
Simple Req/Rep pattern for socket.io (which is Pub/Sub in nature)
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.2/socket.io.js"></script>
<script>
var socket = io('http://localhost:8088');
var route = createRouter((reply) => {
socket.on('rep', reply)
})
socket.emit('req', route('hello world', (data) => {
console.log(data)
}))
@coreyhaines
coreyhaines / Editable.elm
Last active August 25, 2022 05:11
type Editable
module Editable exposing (..)
type Editable ofType
= NotEditing { value : ofType }
| Editing { originalValue : ofType, buffer : ofType }
value : Editable ofType -> ofType
value editable =
@anaclair
anaclair / shopping_cart.md
Last active March 22, 2023 11:46
Implementing Redis Shopping Cart

What is Redis?
Redis is an open source, advanced in-memory key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

######1. If you're running OS X, install redis in terminal using Homebrew : brew install redis

######2. Add the redis and hiredis gems to the project's Gemfile (remember to bundle install after you do this) :

@JunichiIto
JunichiIto / alias_matchers.md
Last active April 16, 2024 16:18
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@HuckyDucky
HuckyDucky / gist:10219649
Last active October 9, 2017 11:01
Testing setup for Capybara and autocomplete
#############################################################################################################
## This is a gist that contains my complete setup, minus gems, that I needed to get my jQuery autocomplete ##
## testing out properly with the RSpec/Capybara/PhantomJS stack. ##
#############################################################################################################
#########################
## spec/spec_helper.rb ##
#########################
ENV["RAILS_ENV"] = 'test'
@vertexclique
vertexclique / cracking.md
Last active April 8, 2024 18:24
Cracking guide for Sublime Text 3 Build 3059 / 3065 ( Mac / Win x86_64 / Windows x86 / Linux x64 / Linux x86 )

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

@micahroberson
micahroberson / estimate.rb
Created July 13, 2013 00:35
Generate and save a pdf to S3 with wicked_pdf and paperclip
# Main reference was lascarides' post at http://stackoverflow.com/questions/14743447/getting-pdf-from-wickedpdf-for-attachment-via-carrierwave
# estimate.rb
# ...
has_attached_file :pdf,
storage: :s3,
s3_credentials: {
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
bucket: ENV['AWS_BUCKET']
@stuliston
stuliston / artists_releases_spec.rb
Created September 10, 2011 04:44
Testing HABTM with rspec and factory girl
require 'spec_helper'
describe "Artists to releases relationship" do
before(:all) do
@kanye = FactoryGirl.create(:artist, :name => 'Kanye West')
@jz = FactoryGirl.create(:artist, :name => 'Jay Z')
@watch_the_throne = FactoryGirl.create(:release, :name => 'Watch the Throne')
@dropout = FactoryGirl.create(:release, :name => 'The College Dropout')
end