NSTimer is a great example of an over-verbose, outdated Objective-C API. To run a simple line of code after a delay, you need to write a lot of boilerplate crap.
How about this:
NSTimer.schedule(5.seconds) {
println("Hello world!")
}| /* | |
| You need to import EventKit | |
| import EventKit | |
| */ | |
| @IBAction func buttonCalendar(sender: AnyObject) { | |
| var eventStore : EKEventStore = EKEventStore() | |
| // 'EKEntityTypeReminder' or 'EKEntityTypeEvent' |
NSTimer is a great example of an over-verbose, outdated Objective-C API. To run a simple line of code after a delay, you need to write a lot of boilerplate crap.
How about this:
NSTimer.schedule(5.seconds) {
println("Hello world!")
}| # lib/tasks/db.rake | |
| namespace :db do | |
| desc "Dumps the database to db/APP_NAME.dump" | |
| task :dump => :environment do | |
| cmd = nil | |
| with_config do |app, host, db, user| | |
| cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump" | |
| end | |
| puts cmd |
| Selectize.define( 'clear_selection', function ( options ) { | |
| var self = this; | |
| //Overriding because, ideally you wouldn't use header & clear_selection simultaneously | |
| self.plugins.settings.dropdown_header = { | |
| title: 'Clear Selection' | |
| }; | |
| this.require( 'dropdown_header' ); | |
| self.setup = (function () { |
| storage = Fog::Storage.new( | |
| provider: 'AWS', | |
| aws_access_key_id: 'xxx', | |
| aws_secret_access_key: 'yyy', | |
| path_style: true | |
| ) | |
| directory = storage.directories.get('yourbucket') | |
| uploaded = directory.files.create( | |
| key: "324324.jpg", |
| # config/routes.rb | |
| resources :documents do | |
| scope module: 'documents' do | |
| resources :versions do | |
| post :restore, on: :member | |
| end | |
| resource :lock | |
| end | |
| end |
| # delete local tag '12345' | |
| git tag -d 12345 | |
| # delete remote tag '12345' (eg, GitHub version too) | |
| git push origin :refs/tags/12345 | |
| # alternative approach | |
| git push --delete origin tagName | |
| git tag -d tagName |
| /* | |
| * BabyHint does a line-by-line check for common beginner programming mistakes, | |
| * such as misspelling, missing spaces, missing commas, etc. It is used in | |
| * conjunction with JSHINT to report errors to the user. | |
| * | |
| * Each error returned contains the members: | |
| * { | |
| * row : the row at which the error was found | |
| * column : the column at which the error was found | |
| * text : the error messaage |
| #!/usr/bin/env bash | |
| # Usage: s3-put <FILE> <S3_BUCKET> [<CONTENT_TYPE>] | |
| # | |
| # Uploads a file to the Amazon S3 service. | |
| # | |
| # Depends on AWS credentials being set via env: | |
| # - AMAZON_ACCESS_KEY_ID | |
| # - AMAZON_SECRET_ACCESS_KEY | |
| # | |
| # Outputs the URL of the newly uploaded file. |
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf
File locations:
nginx.conf to /usr/local/etc/nginx/default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-availablehomebrew.mxcl.nginx.plist to /Library/LaunchDaemons/