Skip to content

Instantly share code, notes, and snippets.

View uson1x's full-sized avatar

Ivan Parfenchuk uson1x

View GitHub Profile
@realvjy
realvjy / ChoasLinesShader.metal
Last active July 30, 2024 18:03
Choas Lines - Metal Shader
// Lines
float hash( float n ) {
return fract(sin(n)*753.5453123);
}
// Slight modification of iq's noise function.
float noise(vector_float2 x )
{
vector_float2 p = floor(x);
vector_float2 f = fract(x);
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active July 2, 2024 22:32
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Want more content like this, for free? Check out my free book, RailsAI!

Alt Text

@izakpavel
izakpavel / LightningView.swift
Created December 3, 2020 07:34
Lightnings in SwiftUI
//
// Lightnings fun
//
// BEWARE highly unoptimized!
//
// Created by Pavel Zak on 30/11/2020.
//
import SwiftUI
@douglashill
douglashill / KeyboardScrollView.swift
Last active May 6, 2021 00:47
A UIScrollView subclass that allows scrolling using a hardware keyboard like NSScrollView. Supports arrow keys, option + arrow keys, command + arrow keys, space bar, page up, page down, home and end.
// Douglas Hill, November 2019
// Find the latest version of this file at https://github.com/douglashill/KeyboardKit
import UIKit
/// A scroll view that allows scrolling using a hardware keyboard like `NSScrollView`.
/// Supports arrow keys, option + arrow keys, command + arrow keys, space bar, page up, page down, home and end.
/// Limitations:
/// - Paging scroll views (isPagingEnabled = true) are not supported yet.
/// - The scroll view must become its own delegate so setting the delegate is not supported yet.

List of iOS Card Sheet Controllers

@OdNairy
OdNairy / update_tf_data.rb
Last active June 2, 2019 19:43
Wait build to be processed and update changelog afterwards. fastlane 2.125+ required.
require 'spaceship'
module Fastlane
module Actions
module SharedValues
UPDATE_TF_CHANGELOG_CUSTOM_VALUE = :UPDATE_TF_CHANGELOG_CUSTOM_VALUE
end
class UpdateTfDataAction < Action
def self.run(params)
@alameenkhader
alameenkhader / rails-rpush.md
Last active August 28, 2020 09:10
Rpush/Rails Integration

###rpush - https://github.com/rpush/rpush

Follow the steps in rpush to add the gem to your rails project

####PushNotificationDevice

rails g model PushNotificationDevice device_type:integer:index device_token:string
class CreatePushNotificationDevices < ActiveRecord::Migration
@jstn
jstn / Timer.swift
Last active June 19, 2022 15:14
simple nanosecond timer using mach_absolute_time
/*
var t = Timer()
t.start()
// do something
t.stop()
print("took \(t.seconds)")
*/
@MonsieurDart
MonsieurDart / MFMailComposeViewController+URLRequest.h
Created January 20, 2011 15:46 — forked from futuretap/WebViewController.m
Intercept mailto URLs in a UIWebView and send them to a MFMailComposeViewController
#import <Foundation/Foundation.h>
#import <MessageUI/MessageUI.h>
@interface NSURL (MailComposeViewController)
// Is the given request a mailto URL.
- (BOOL)isMailtoRequest;
@end
//
// UACellBackgroundView.m
// Ambiance
//
// Created by Matt Coneybeare on 1/31/10.
// Copyright 2010 Urban Apps LLC. All rights reserved.
//
#define TABLE_CELL_BACKGROUND { 1, 1, 1, 1, 0.866, 0.866, 0.866, 1} // #FFFFFF and #DDDDDD
#define kDefaultMargin 10