Skip to content

Instantly share code, notes, and snippets.

View dsci's full-sized avatar

Daniel Schmidt dsci

  • Leipzig, Germany
View GitHub Profile
{
"cmd": ["bash", "-c", "clang -lobjc -framework Cocoa -framework Carbon -o /tmp/sublime-objc-output $file"],
"file_regex": "^(.*?):([0-9]+):([0-9]+): (.*)",
"selector": "source.objc",
"variants": [
{
"name": "Run",
"cmd": ["bash", "-c", "clang -lobjc -framework Cocoa -framework Carbon -o /tmp/sublime-objc-output $file && /tmp/sublime-objc-output"]
}
]
@dsci
dsci / class.coffee
Last active December 14, 2015 23:59 — forked from lancejpollard/class.coffee
moduleKeywords = ['included', 'extended', 'prototype']
class Class
# Rename an instance method
#
# ``` coffeescript
# class User
# @alias "methods", "instance_methods"
#
# ```
@dsci
dsci / README.md
Last active December 10, 2015 12:38
A Ruby example implementation of DCI (Data Context Interaction). To play around.

The paradigm separates the domain model (data) from use cases (context) and roles that objects play (interaction). DCI is complementary to model–view–controller (MVC). MVC as a pattern language is still used to separate the data and its processing from presentation.

class AppDelegate
def applicationDidFinishLaunching(a_notification)
foo = FooBar.new
# call Objective-C method from MacRuby which calls a MacRuby method.
foo.getBarFromRuby
# call a second Objective-C method from MacRuby which calls a MacRuby
# method returning a Hash
foo.getBarContentFromRuby
@dsci
dsci / mac_ruby_json.rb
Created August 20, 2012 09:08
Dumping JSON from NSTextField
def settings_save_clicked(sender)
settings = Setting.current
attributes = {
"api_endpoint" => "#{api_endpoint_field.stringValue}",
"user_name" => "#{user_name_field.stringValue}",
"api_key" => "#{api_key_field.stringValue}"
}
MultiJSON.dump(attributes)
end
@dsci
dsci / drop.sh
Created August 7, 2012 09:40
Dropping all tables in a PostgreSQL database
# first, login with psql
psql -U USERNAME -d databasename
# set output for all queries
\o FILENAME.sql
# run this query
select 'drop table ' || tablename || ' cascade;' from pg_tables;
# logout from psql
@dsci
dsci / lsbom.sh
Created August 5, 2012 19:26
Checking *.pkg install path osx
lsbom -f -l -s -pf $HOME/Library/Receipts/APPPKGNAME.pkg.bom
@dsci
dsci / Readme.md
Created July 26, 2012 21:50
RSpec Matcher Response Status

Nutzbar wie folgt:

response.should have_status "Found" # 302
response.should have_status "Bad Gateway" # 502
Feature: Adding a post to my timeline
In order to tell my friends what I currently do
As registered user
I want to add a post
Background: Existing user is logged in
Given my username is "dsci",my password is "123456" and my email is "dsci@code79.net"
When I visit the ritter start page
Then I should see the login form
When I fill in "email" with "dsci"
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "centos-6"