Skip to content

Instantly share code, notes, and snippets.

View ShingoFukuyama's full-sized avatar

Shingo Fukuyama ShingoFukuyama

  • Japan
View GitHub Profile
@ShingoFukuyama
ShingoFukuyama / AsHomeApp
Last active April 24, 2023 02:42
[Bookmarklet] Save any website as a standalone home app
javascript:%3B%28function%28d%29%7Blet%20html%3Dd.querySelector%28%27html%27%29%3Blet%20head%3Dd.querySelector%28%27head%27%29%3Bif%28%21head%29%7Bhead%3Dd.createElement%28%27head%27%29%3Bhtml.appendChild%28head%29%3B%7D%0Afunction%20setMeta%28name%2Cvalue%29%7Blet%20meta0%3Dd.querySelector%28%27meta%5B%27+name+%27%5D%27%29%3Bif%28meta0%29%7Bmeta0.content%3Dvalue%3B%7Delse%7Bmeta0%3Dd.createElement%28%27meta%27%29%3Bmeta0.name%3Dname%3Bmeta0.content%3Dvalue%3Bhead.appendChild%28meta0%29%3B%7D%7D%0AsetMeta%28%27mobile-web-app-capable%27%2C%27yes%27%29%3BsetMeta%28%27apple-mobile-web-app-capable%27%2C%27yes%27%29%3BsetMeta%28%27apple-mobile-web-app-status-bar-style%27%2C%27black%27%29%3B%7D%29%28document%29%3B
@ShingoFukuyama
ShingoFukuyama / init.el
Created September 2, 2017 10:06
~/.spacemacs.d/init.el
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@ShingoFukuyama
ShingoFukuyama / AppDelegate.swift
Created August 18, 2017 23:30
iOS project without storyboard. AppDelegate.swift
/*
1. Delete `main.storyboard`
2. Emptify `Main Interface` on the project's general page
3. Add below code inside `application:didFinishLaunchingWithOptions`
*/
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.main.bounds)
if let window = self.window {
@ShingoFukuyama
ShingoFukuyama / AddToHome
Last active July 25, 2017 15:20
A bookmarklet for Mobile Safari (iPhone/iPad). Make normal websites as standalone applications.
javascript:;(function(d) {let html = d.querySelector('html');let head = d.querySelector('head');if (!head) {head = d.createElement('head');html.appendChild(head);}let meta1 = d.querySelector('meta[name=apple-mobile-web-app-capable]');if (meta1) {meta1.content = 'yes';} else {meta1 = d.createElement('meta');meta1.name = 'apple-mobile-web-app-capable';meta1.content = 'yes';head.appendChild(meta1);}let meta2 = d.querySelector('meta[name=apple-mobile-web-app-status-bar-style]');if (meta2) {meta2.content = 'black'; /* black-translucent, black, default */} else {meta2 = d.createElement('meta');meta2.name = 'apple-mobile-web-app-status-bar-style';meta2.content = 'black';head.appendChild(meta2);}})(document);
@ShingoFukuyama
ShingoFukuyama / 0_reuse_code.js
Created July 4, 2017 07:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ShingoFukuyama
ShingoFukuyama / strings.xml
Last active May 16, 2017 02:51
Android strings.xml for FontAwesome v4.7
<resources>
<!--fontawesome v4.7 http://fontawesome.io/-->
<string name="fa_500px">&#xf26e;</string>
<string name="fa_address_book">&#xf2b9;</string>
<string name="fa_address_book_o">&#xf2ba;</string>
<string name="fa_address_card">&#xf2bb;</string>
<string name="fa_address_card_o">&#xf2bc;</string>
<string name="fa_adjust">&#xf042;</string>
<string name="fa_adn">&#xf170;</string>
@ShingoFukuyama
ShingoFukuyama / config.py
Last active March 7, 2017 12:42
Keyhac [~/Library/Application Support/Keyhac/config.py]
import sys
import os
import datetime
import subprocess
from keyhac import *
def configure(keymap):
@ShingoFukuyama
ShingoFukuyama / MyButtonForInterfaceBuilder
Created October 20, 2016 12:35
Add border to UIButton on Xcode Interface Builder
//
// MyButton.h
#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface MyButton : UIButton
@property (nonatomic, weak) IBInspectable UIColor *borderColor;
@ShingoFukuyama
ShingoFukuyama / UITextView+EmacsKeyboardShortcut.swift
Created October 10, 2016 08:10
WIP: iOS Keyboard Shortcut for Emacs
//
// UITextView+Ext.swift
// BTKeyboardInputTest
//
// Created by Shingo Fukuyama on 10/10/16.
// Copyright © 2016 Shingo Fukuyama. All rights reserved.
//
import UIKit
// ==UserScript==
// @name 0AutoPagerize SITEINFO
// @namespace http://ss-o.net/
// @description oAutoPagerize SITEINFO
// @include http*
// @checkurl http://ss-o.net/userjs/0AutoPagerize.SITEINFO.user.js
// ==/UserScript==
(function(){
if (this.chrome) {
window.addEventListener('ChromeAutoPagerizeInitialize',function(evt){