Skip to content

Instantly share code, notes, and snippets.

View alxndr's full-sized avatar

Alexander Quine alxndr

View GitHub Profile
@alxndr
alxndr / chat_demo.ex
Last active August 29, 2015 14:15 — forked from namxam/chat_demo.ex
defmodule Chat.Client do
def join(server) do
client_send server, :join
end
def say(server, message) do
client_send server, { :say, message }
end
def leave(server) do
@alxndr
alxndr / evaluator-patch.diff
Last active August 29, 2015 14:21
concept: working `|>`-prefix in iex
diff --git a/lib/iex/lib/iex/evaluator.ex b/lib/iex/lib/iex/evaluator.ex
index ac31d93..9922aba 100644
--- a/lib/iex/lib/iex/evaluator.ex
+++ b/lib/iex/lib/iex/evaluator.ex
@@ -89,6 +89,17 @@ defmodule IEx.Evaluator do
try do
do_eval(String.to_char_list(code), state, history)
catch
+ kind, error = %{description: "syntax error before: '|>'"} ->
+ if can_repipe?(code, history) do
@alxndr
alxndr / sanity_test.exs
Created September 18, 2015 01:12
Sanity test for Elixir projects. Place directly in the `test/` directory.
defmodule App.SanityTest do
@directory_separator "/"
@test_dir __DIR__
@excluded_dirs ~w(factories support fixture vcr_cassettes custom_cassettes)
@excluded_files ~w(test_helper.exs)
test "checks that all test files are named properly" do
bad_files =
Path.join([@test_dir, "**", "*"])
|> Path.wildcard
@alxndr
alxndr / factories_spec.rb
Last active November 24, 2015 20:16
test FactoryGirl factories (including uniqueness)
require 'spec_helper'
non_idempotent_factories = [:the_president] # singletons
broken_factories = [] # just in case
FactoryGirl.factories.map(&:name).reject{|factory_sym| broken_factories.include? factory_sym}.each do |factory_sym|
factory_name = factory_sym.to_s.camelize
describe "The #{factory_name} factory" do
let(:first) { FactoryGirl.build factory_sym }
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#

Integration Testing Setup with RSpec and Capybara

by Paul Elliott, May 11, 2010, content retrieved using Internet Archive's Wayback Machine

Integration testing is critical for modern web applications. It provides a chance to exercise all the features of your site in a real or mock browser and make sure that everything still work correctly with any changes made. It plays a key role in insuring the quality of your application and that your users have as bug-free an environment as possible.

Integrating it into your existing rspec setup is a breeze, too. I am a big fan of Jonas Nicklas’ Capybara (http://github.com/jnicklas/capybara), which is a great gem that lets you mix and match web drivers over a common interface and allows you to test specific functions of your site with the appropriate platform. You can easily use it directly with RSpec to write a comprehensive integration test suite for your application.

Let’s get started by running rake. If you don’t

Keybase proof

I hereby claim:

  • I am alxndr on github.
  • I am alxndr (https://keybase.io/alxndr) on keybase.
  • I have a public key whose fingerprint is DD42 73E5 4D56 995C 767B 5176 56A0 79B0 E81E 5F1B

To claim this, I am signing this object:

@alxndr
alxndr / How I saved a year of our family pictures from a dead hard drive. "How I saved a year of our family pictures from a dead hard drive." saved ars forum
Copied from http://arstechnica.com/civis/viewtopic.php?f=19&t=1197911 (via http://www.libertypages.com/clarktech/?p=349)
-----------------------------------------------
MarkLT1
Ars Scholae Palatinae
et Subscriptor
Tribus: Where the women are strong, the men are good looking, and all the children are above average.
Registered: Nov 11, 2002
Posts: 924
-----------------------------------------------
@alxndr
alxndr / code.js
Last active November 6, 2016 21:31 — forked from maxkfranz/code.js
phish song co-occurrence graph
const uniq = array => [...new Set(array)];
const flatten = (arr) => arr.reduce((a, b) => a.concat(b), []);
const extractUniqueShowYears = showsData => {
return uniq(showsData.map((showData) => showData.date.split("-")[0]).sort());
};
const extractJSON = response => response.json();
const fetchJSON = url => fetch(url).then(extractJSON);
@alxndr
alxndr / twkey.md
Created February 28, 2019 04:26
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA