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 'aws/s3' | |
class StoredFile < ActiveRecord::Base | |
include AWS::S3 | |
after_destroy :delete_on_s3! | |
validates_presence_of :filename, :size, :content_type | |
validates_numericality_of :size, :greater_than => 0 | |
def extension |
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 git_info | |
@@info ||= begin | |
{ | |
:application => app_name = (Rails.application.class.to_s.split('::').first rescue ""), | |
:environment => Rails.env, | |
:remote_url => `git remote -v`, | |
:remote_branch => `git branch -r`, | |
:last_commit => `git log --max-count=1` | |
} | |
rescue |
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
<iframe id="theGameFrame" src="about:blank" width="784" height="1000"></iframe> | |
<script type="text/javascript"> | |
(function () { | |
"use strict"; | |
var hash, match, | |
location = document.location.href, | |
theFrame = document.getElementById('theGameFrame'); |
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 | |
# Author: Alexander Schulz | |
VHOSTEN="/etc/nginx/sites-enabled/" | |
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]] | |
then | |
echo 'Usage: n2dissite VHOST' | |
echo 'Disables Nginxs virtualhost VHOST.' |
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 SampleViewModel extends ko.ViewModel | |
@property "firstName" | |
@property "lastName" | |
@accessor "fullName", | |
read: -> | |
@firstName() + " " + @lastName() | |
write: (v) -> | |
[first, last] = v.split(" ") | |
@firstName first |
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
.idea/**/*.iws | |
.idea/workspace.xml | |
.idea/tasks.xml |
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
# http://www.mono-project.com/Compiling_Mono_on_OSX | |
require 'formula' | |
class Mono < Formula | |
url 'http://download.mono-project.com/sources/mono/mono-3.2.1.tar.bz2' | |
sha1 '7f4f31e03903719e370e7ee94ded376b96bdf6d9' | |
homepage 'http://www.mono-project.com/' | |
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
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.8+' | |
} | |
} |
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
module ResourcesController | |
extend ActiveSupport::Concern | |
def index | |
render json: resources | |
end | |
def show | |
render json: resource |
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 Card {} | |
class Customer { | |
var optionalCard: Card? | |
var card: Card | |
init() { | |
self.card = Card() // required to avoid compiler error (card2 would be nil) | |
} | |
} | |
let john : Customer? = Customer() |
OlderNewer