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 ParentThing < ActiveRecord::Base | |
include SecureThingBehavior | |
# Make the storage location of all our secure things accessible | |
# along with whatever else you need. | |
attr_accessible :secure | |
end | |
class ThingA < ParentThing | |
attr_secure :meeting_location, :meeting_passcode |
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 test1 | |
[1,2,3,4,5].each do |item| | |
next if item == 3 | |
puts item | |
end | |
end | |
def test2 | |
[1,2,3,4,5].each do |item| |
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
case class ContactPhones( home_phone:Option[String] = None, work_phone:Option[String] = None, | |
cell_phone:Option[String] = None) | |
case class ContactName( first_name:Option[String] = None, middle_name:Option[String] = None, | |
last_name:Option[String] = None) | |
case class Contact(email_addresses:List[EmailAddress], action_by:String, id:Long = 0, | |
status:Option[Status.Value] = None, prefix_name:Option[String] = None, | |
name:Option[ContactName] = None, job_title:Option[String] = None, | |
department_name:Option[String] = None, company_name:Option[String] = None, | |
phone:Option[ContactPhones] = None, fax:Option[String] = None, | |
addresses:List[Address] = List(), notes:List[Note] = List(), |
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
// If we receive a jQuery JSONP call and we don't call the callback, add in a bogus | |
// call to the callback function. | |
LiftRules.responseTransformers.append { response => | |
response.toResponse match { | |
case resp @ InMemoryResponse(data, headers, _, _) => | |
{ | |
for(callback <- S.param("callback")) yield { | |
val dataStr = new String(data) | |
if (! dataStr.contains(callback)) { |
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
import net.liftweb.mongodb._ | |
import BsonDSL._ | |
trait Animal { | |
def makeNoise(): String | |
} | |
case class Dog(name: String, breed: String) extends Animal { | |
def makeNoise() = { | |
"Woof" |
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
describe("GET /api/v1/embed/*") { | |
it("should return 200 and a jscmd for a valid tab id") { | |
runApiRequest("/api/v1/embed/" + validTab._id.toString, None, _.parameters = List("callback" -> "123")) { response => | |
response match { | |
case Full(JavaScriptResponse(jscmd, _, _, code)) => | |
code should equal (200) | |
case somethingUnexpected => fail(somethingUnexpected.toString) | |
} | |
} |
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/sh | |
iptables-restore < /etc/iptables.rules | |
ip6tables-restore < /etc/ip6tables.rules | |
exit 0 |
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
#include "StdAfx.h" | |
#include ".\binarysearch.h" | |
#include <stdlib.h> | |
#include <stdio.h> | |
BSNode::BSNode() { | |
this->lessThan = NULL; | |
this->greaterThan = NULL; | |
} |
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 | |
command -v aws >/dev/null 2>&1 || { echo >&2 "I require the AWS cli, but it is not installed."; exit 1; } | |
command -v jq >/dev/null 2>&1 || { echo >&2 "I require jq, but it is not installed."; exit 1; } | |
#export AWS_ACCESS_KEY_ID=ACCESS_KEY_HERE_IF_NOT_ALREADY_IN_ENVIRONMENT | |
#export AWS_SECRET_ACCESS_KEY=SECRET_KEY_HERE_IF_NOT_ALREADY_IN_ENVIRONMENT | |
#export AWS_DEFAULT_REGION=REGION_HERE_IF_NOT_ALREADY_IN_ENVIRONMENT | |
INSTANCE_ID=INSTANCE_ID_HERE |
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
version: 2 | |
myservice: | |
image: ubuntu:15.10 | |
environment: | |
- DOCKER_TLS_VERIFY | |
- DOCKER_HOST | |
- DOCKER_CERT_PATH |