Skip to content

Instantly share code, notes, and snippets.

View mrcljx's full-sized avatar

Marcel Jackwerth mrcljx

View GitHub Profile
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
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
@mrcljx
mrcljx / index.html
Created April 20, 2012 15:06
Intelligent iFrame
<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');
@mrcljx
mrcljx / n2dissite.sh
Created May 21, 2012 19:17 — forked from hlfbt/n2dissite.sh
Nginx-to-ensite and Nginx-to-dissite - Two simple scripts that enable and disable Nginxs virtualhost VHOST. Adapt VHOSTEN and VHOSTAV accordingly, place in /usr/sbin and enjoy.
#!/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.'
@mrcljx
mrcljx / example.coffee
Last active December 19, 2015 07:29
Simple KO support library
class SampleViewModel extends ko.ViewModel
@property "firstName"
@property "lastName"
@accessor "fullName",
read: ->
@firstName() + " " + @lastName()
write: (v) ->
[first, last] = v.split(" ")
@firstName first
@mrcljx
mrcljx / root.gitignore
Created July 24, 2013 10:47
Gitignores for IDEA based on http://devnet.jetbrains.com/docs/DOC-1186. Either use `root.gitignore` (if you have git version 1.8.2) or use `subfolder.gitignore` and place it in your .idea folder.
.idea/**/*.iws
.idea/workspace.xml
.idea/tasks.xml
@mrcljx
mrcljx / mono.rb
Last active December 21, 2015 14:09 — forked from shtirlic/mono.rb
# 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/'
@mrcljx
mrcljx / build.gradle
Created February 5, 2014 10:50
Simple Gradle Buildfile for PebbleKit 2.0
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8+'
}
}
module ResourcesController
extend ActiveSupport::Concern
def index
render json: resources
end
def show
render json: resource
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()