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
# config/routes.rb | |
resources :documents do | |
scope module: 'documents' do | |
resources :versions do | |
post :restore, on: :member | |
end | |
resource :lock | |
end | |
end |
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
var https = require('https'); | |
// CONFIGURATION ####################################################################################################### | |
var token = 'SLACK TOKEN'; | |
var channel = 'CHANNEL ID'; | |
var privateChannel = false; | |
var delay = 300; // delay between delete operations in millisecond | |
// GLOBALS ############################################################################################################# |
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
func showPushNotification(title: String, details: String) { | |
if #available(iOS 10.0, *) { | |
let interval = TimeInterval(1) | |
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: interval, repeats: false) | |
let content = UNMutableNotificationContent() | |
content.title = title | |
content.body = details | |
let req = UNNotificationRequest(identifier: "localPushNotification", content: content, trigger: trigger) | |
let center = UNUserNotificationCenter.current() | |
center.getNotificationSettings(completionHandler: { settings in |
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
# SSL self signed localhost for rails start to finish, no red warnings. | |
# 1) Create your private key (any password will do, we remove it below) | |
$ openssl genrsa -des3 -out server.orig.key 2048 | |
# 2) Remove the password | |
$ openssl rsa -in server.orig.key -out server.key |
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
#!/usr/bin/env ruby | |
require "webrick" | |
=begin | |
WEBrick is a Ruby library that makes it easy to build an HTTP server with Ruby. | |
It comes with most installations of Ruby by default (it’s part of the standard library), | |
so you can usually create a basic web/HTTP server with only several lines of code. | |
The following code creates a generic WEBrick server on the local machine on port 1234, |
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 point_in_polygon?(polygonPoints) | |
return false if self.latitude.blank? or self.longitude.blank? | |
polygonPoints.each do |point| | |
point[0] = point[0].to_f | |
point[1] = point[1].to_f | |
end | |
contains_point = false | |
i = -1 | |
j = polygonPoints.size - 1 |