Skip to content

Instantly share code, notes, and snippets.

View ksugawara61's full-sized avatar

k2o ksugawara61

  • Kanagawa Japan
View GitHub Profile
@joshbetz
joshbetz / Webview.swift
Last active October 13, 2023 19:36
SwiftUI Webview with a Progress Bar
struct Webview: UIViewControllerRepresentable {
let url: URL
func makeUIViewController(context: Context) -> WebviewController {
let webviewController = WebviewController()
let request = URLRequest(url: self.url, cachePolicy: .returnCacheDataElseLoad)
webviewController.webview.load(request)
return webviewController
@aboutgaurav
aboutgaurav / BottomNavigationViewHelper.java
Created November 4, 2017 17:38
Disable android 'BottomNavigationView' shift mode.
import android.support.design.internal.BottomNavigationItemView;
import android.support.design.internal.BottomNavigationMenuView;
import android.support.design.widget.BottomNavigationView;
import android.util.Log;
import java.lang.reflect.Field;
/**
* Helper class to get rid of "Shift Mode" from BottomNavigationView
*/
@rharter
rharter / SharedPreferenceLiveData.kt
Last active March 19, 2023 08:15
Creates LiveData objects that observe a value in SharedPreferences while they have active listeners.
import android.arch.lifecycle.LiveData
import android.content.SharedPreferences
abstract class SharedPreferenceLiveData<T>(val sharedPrefs: SharedPreferences,
val key: String,
val defValue: T) : LiveData<T>() {
private val preferenceChangeListener = SharedPreferences.OnSharedPreferenceChangeListener { sharedPreferences, key ->
if (key == this.key) {
value = getValueFromPreferences(key, defValue)
@kawanet
kawanet / string_to_buffer.js
Last active May 16, 2024 10:35
String と ArrayBuffer の相互変換 JavaScript
// 文字列から ArrayBuffer への変換
function string_to_buffer(src) {
return (new Uint16Array([].map.call(src, function(c) {
return c.charCodeAt(0)
}))).buffer;
}
// ArrayBuffer から文字列への変換
@bobbygrace
bobbygrace / trello-css-guide.md
Last active May 15, 2024 16:01
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@kenjiskywalker
kenjiskywalker / nginx_ssl_server_name.md
Last active February 18, 2024 21:11
nginxのserver_nameとSSLの設定についてのメモ
@IanVaughan
IanVaughan / uninstall_gems.sh
Created June 9, 2012 20:37
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@timw4mail
timw4mail / index.php
Created August 18, 2011 19:39
PHP Kana transliterator
<?php
include("kana.php");
if(isset($_GET['in']) && isset($_GET['action']))
{
$in = $_GET['in'];
if($_GET['action'] == "to_hira")
{
$out = Kana::to_hiragana($in);