Skip to content

Instantly share code, notes, and snippets.

View kenjikato's full-sized avatar
💭
Thinking really hard 🤔

Kenji Kato kenjikato

💭
Thinking really hard 🤔
View GitHub Profile
@code-boxx
code-boxx / 0-PWA.MD
Created June 10, 2023 02:04
Simple Progressive Web App Example
@kenjikato
kenjikato / .zshrc
Last active November 1, 2021 07:50
.zshrc-for-macos
# An enhanced .zshrc for macOS
#
# =====================================
# MAKE THE TERMINAL LOOK MORE COLORFUL
# =====================================
# Load the colors functionality into zsh. Go here to learn more about colors: https://unix.stackexchange.com/questions/19498/understanding-colors-in-zsh
autoload -Uz colors && colors #Want to know about autoload go here: https://stackoverflow.com/questions/30840651/what-does-autoload-do-in-zsh
# set a fancy prompt (non-color, unless we know we "want" color)
@deepakraj27
deepakraj27 / AttachmentHandler.swift
Last active November 1, 2023 08:40
Access Camera, Photo Library, Video and File from User device using Swift 4
//
// AttachmentHandler.swift
// AttachmentHandler
//
// Created by Deepak on 25/01/18.
// Copyright © 2018 Deepak. All rights reserved.
//
import Foundation
import UIKit
@bgayman
bgayman / FilterCam.swift
Last active September 25, 2022 00:42
Setup AVCaptureSession with CIFilter
//
// ViewController.swift
// CameraFilter
//
import UIKit
import AVFoundation
class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate {
@pcan
pcan / README.md
Last active July 7, 2024 01:28
Node.js plain TLS Client & Server, 2-way Cert Auth

Node.js TLS plain TLS sockets

This guide shows how to set up a bidirectional client/server authentication for plain TLS sockets.

Newer versions of openssl are stricter about certificate purposes. Use extensions accordingly.

Prepare certificates

Generate a Certificate Authority:

@tartakovsky
tartakovsky / #Guide: Stopwatch Swift
Last active October 3, 2016 16:27
Reusable Stopwatch class implemented in Swift
This is the implementation of Stopwatch class.
Usage:
1. Add the Stopwatch.swift file to the project
2. Create instance and assing the callback function
let stopwatch = Stopwatch()
stopwatch.callback = self.tick
3. Implement the callback function
@boopathi
boopathi / README.md
Last active August 28, 2023 14:35
Creating a Swift-ReactNative project

Settings

  1. Create a project in XCode with the default settings
    • iOS > Application > Single View Application
    • Language: Swift
  2. Under project General settings, add ReactKit to Linked Framework and Libraries
    • + > Add Other... and choose /path/to/react-native/ReactKit/ReactKit.xcodeproj
  3. Now ReactKit would have been imported. Link it by choosing it from the list.
    • + > lib.ReactKit.a
  4. Under project Build Settings,
@kristopherjohnson
kristopherjohnson / Stopwatch.swift
Last active July 13, 2022 11:24
Swift classes for calculating elapsed time, similar to .NET's System.Diagnostics.Stopwatch class
// Copyright (c) 2017 Kristopher Johnson
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// Example Hammer 1.x code:
var body = document.getElementsByTagName('body')[0];
var armAndHammer = new Hammer(body, options);
armAndHammerr.on('tap', tapEvent(ev));
function tapEvent (ev) {
var touchEl; // dom element which you want to act on
if (ev.target === tocuhEl) {
handleTapEvent(); // what you actally want to do on tap
@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)")
*/