This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def destroy | |
warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#failure") | |
current_user.update_column(:authentication_token, nil) | |
sign_out | |
render :status => 200, | |
:json => { :success => true, | |
:info => "Logged out", | |
:csrfParam => request_forgery_protection_token, | |
:csrfToken => form_authenticity_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app = angular.module('app', ['ngResource']) | |
app.factory("Result", ["$resource", ($resource) -> | |
$resource("/scrapes/:scrape_id/results/:id", {scrape_id: "@scrape_id", id: "@id"}) | |
]) | |
app.controller("MainCtrl", ['$scope','Result',($scope,Result)-> | |
$scope.scrape = {id: 1} | |
$scope.results = [] | |
$scope.getResults = (-> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a1 = ["html", "body", "ul", "li", "a"] | |
a2 = ["html", "body", "ul", "li", "p"] | |
a1.zip(a2).map{|n| n.first if n.first == n.last}.compact |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example 1 | |
array = [1] # input value is a single item in aray | |
array = array.size == 1 ? array.first : array | |
# => 1 | |
# example 2 | |
array = [1,2,3] # input value is a collection of items in a array | |
array = array.size == 1 ? array.first : array | |
# => [1,2,3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative 'test_helper' | |
require 'capybara' | |
require 'capybara/poltergeist' | |
class ArraySotringTest < MiniTest::Test | |
def test_drill_down | |
session = Capybara::Session.new(:poltergeist) | |
session.visit "http://0.0.0.0:9494/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global module:false */ | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
karma:{ | |
unit: { | |
configFile: 'karma.conf.js' | |
} | |
}, | |
watch: { | |
files: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
can :create, Something | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vi: expandtab filtype=dockerfile | |
FROM base | |
MAINTAINER Lee Hambley "[email protected]" | |
# Debian isn't too smart, there's no tty dude! | |
ENV DEBIAN_FRONTEND noninteractive | |
# Update Apt, never a bad move | |
RUN apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Page</title> | |
</head> | |
<body> | |
<div> | |
<div> | |
<strong>Hello World</strong> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
cp config/database.yml.example config/database.yml | |
# bundle install | |
postgres -D /usr/local/var/postgres > /dev/null 2>&1 & | |
POSTGRES_PID=$! | |
redis-server > /dev/null 2>&1 & |