Skip to content

Instantly share code, notes, and snippets.

@jevin
jevin / ViewController.swift
Last active March 28, 2017 02:18
iOS In-App Ratings
import UIKit
import StoreKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
SKStoreReviewController.requestReview()
}
@jevin
jevin / Rails Code
Created July 30, 2019 11:56
Using ActionCable in Expo/React Native
# config/routes.rb
Rails.application.routes.draw do
mount ActionCable.server, at: '/cable'
end
# app/channels/chat_channel.rb
class ChatChannel < ApplicationCable::Channel
def subscribed
stream_from "chat_channel"
end
@jevin
jevin / remove_similar_dates.rb
Last active September 20, 2021 04:25
Removes dates within X seconds of each other in an array
require 'date'
def remove_similar_dates(dates, delta=3)
dates.map!{ |date| date.strftime("%s").to_i }.sort!
for index_1 in (0..dates.size) do
item_1 = dates[index_1]
if item_1 != nil
marked = []