Skip to content

Instantly share code, notes, and snippets.

View exocode's full-sized avatar
🏠
Working from home

Jan exocode

🏠
Working from home
View GitHub Profile
[Unit]
Description=Puma HTTP Server
After=network.target
# Uncomment for socket activation (see below)
# Requires=puma.socket
[Service]
# Foreground process (do not use --daemon in ExecStart or config.rb)
Type=simple
@exocode
exocode / Swift-Codable.swift
Created July 8, 2017 19:13 — forked from ahcode0919/Swift-Codable.swift
Swift 4 Codable example (Type -> JSON)
//Simple Type - Person
struct Person: Codable {
let name: String
let age: Int
func getString() -> String {
return "Name: \(name), Age: \(age)"
}
}
import UIKit
import FacebookCore
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
@exocode
exocode / Swift3JSONStructs.swift
Last active August 23, 2016 22:32 — forked from stinger/Swift3JSONStructs.swift
Swift 3: JSON-serializable structs using protocols swift 3 beta-6
//: # Swift 3: JSON-serializable structs using protocols
//: Most of the implementation is based on the code in [this blog post](http://codelle.com/blog/2016/5/an-easy-way-to-convert-swift-structs-to-json/)
import Foundation
//: ### Defining the protocols
protocol JSONRepresentable {
var JSONRepresentation: Any { get }
}
@exocode
exocode / swift.sh
Created June 18, 2016 13:20 — forked from kavu/swift.sh
Minimal Swift command line Hello World
#!/bin/sh
# So you've installed XCode 6 Beta
# Now we could use Swift toolchain to build a minimal
# command line Hellow World
# let's set new Developer Toolchain bundled with Xcode6-Beta.app
# as default toolchain
# sudo xcode-select -s /Applications/Xcode6-Beta.app/Contents/Developer
# alias for Swift binary
@exocode
exocode / 2012073001_rails_dbsync.mdown
Last active September 21, 2015 00:17 — forked from bricker/2012073001_rails_dbsync.mdown
Rails: Synchronizing your development database with your production database using Rake tasks

Rails: Synchronizing your development database with your production database using Rake tasks

July 30, 2012

If you run an active website with lots of new content every day, it's often helpful to keep your local database up-to-date with your production database, so when you're working on the application locally you're working with fresh content.

Here are a couple rake tasks that you can copy-and-paste into your local Rails application which will make this syncing process a one-step process.

@exocode
exocode / Good Meteor Packages
Last active September 6, 2015 00:17 — forked from Posnet/Good Meteor Packages
Good Meteor Packages
# Default Packages
accounts-password
email
jquery
meteor-platform
reactive-var
# Default Development packages
autopublish
insecure
@exocode
exocode / application_helper.rb
Last active July 23, 2024 14:28 — forked from juggy/call_template.rb
Render with ``render_to_string`` a complete page within a sidekiq worker including current_user
module ApplicationHelper
def current_user
@current_user ||= warden.authenticate(:scope => :user)
end
end
def redirect_back_or_default(default)
redirect_to(session[:return_to] || default)
session[:return_to] = nil
end
def redirect_referrer_or_default(default)
redirect_to(request.referrer || default)
end
<template name="ForgotPassword">
<form action="/forgot" id="forgotPasswordForm" method="post">
<input id="forgotPasswordEmail" type="text" name="email" placeholder="Email Address">
<input class="btn-submit" type="submit" value="Send">
</form>
<!-- end #forgot-password-form -->
</template>