Skip to content

Instantly share code, notes, and snippets.

View yuya-oc's full-sized avatar
👨‍💻

Yuya Ochiai yuya-oc

👨‍💻
View GitHub Profile
@yuya-oc
yuya-oc / show-large-album-art-on-itunes-store.ts
Last active October 21, 2018 13:32
Show large album art on iTunes Store (TypeScript)
const source = document.getElementsByClassName("we-artwork__source")
const srcset = source[0].getAttribute('srcset');
if (srcset){
const imgURL = srcset.split(' ')[0].replace(/[^/]*\.jpg$/, "2000x0w.jpg")
window.open(imgURL)
}
@yuya-oc
yuya-oc / main.js
Created January 22, 2017 16:18
Electronのセキュリティ パーミッション制御 ref: http://qiita.com/yuya-oc/items/74faddb78247f7ac2712
// 作成時点のバージョン: 1.4.15
const {app, BrowserWindow} = require('electron');
let win;
app.on('ready', () => {
win = new BrowserWindow({
webPreferences: { nodeIntegration: false }
});
win.loadURL('https://webrtc.github.io/samples/src/content/getusermedia/gum/');
win.on('close', () => {
app.quit();
@yuya-oc
yuya-oc / Vagrantfile
Created September 27, 2016 13:08
Vagrantfile - nginx with self-signed certificate
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@yuya-oc
yuya-oc / index.html
Created April 21, 2016 12:07
Test for webview.getWebContents() login event
<html>
<body>
<input type="button" value="Load" onclick="onButtonClick()"></input>
<webview id="webview0" src="https://example.com" style="display:inline-flex; width:640px; height:480px"></webview>
</body>
<script>
var handler = function(event, request, authInfo, callback){
event.preventDefault();
console.log(event);
console.log(request);
@yuya-oc
yuya-oc / file0.js
Last active March 10, 2016 15:37
ElectronでBrowserWindowやwebviewの証明書エラーに対処する ref: http://qiita.com/yuya-oc/items/2764bf7a33c751498858
app.on('certificate-error', function(event, webContents, url, error, certificate, callback) {
event.preventDefault();
callback(true);
});
@yuya-oc
yuya-oc / main.js
Created February 3, 2016 15:27
simplest electron-mattermost app
'use strict';
const electron = require('electron');
const app = electron.app; // Module to control application life.
const BrowserWindow = electron.BrowserWindow; // Module to create native browser window.
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow = null;
@yuya-oc
yuya-oc / docker-env.sh
Last active May 24, 2017 20:43
docker-env command to set docker-machine env variables
# add to .bashrc or .bash_profile
function docker-env(){
eval "$(docker-machine env $@)"
}
// wxWidgets "Hello world" Program
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
//#define USE_GUI_THREAD
#ifdef USE_GUI_THREAD
@yuya-oc
yuya-oc / .bash_aliases
Created October 11, 2012 13:39
.bash_aliases
alias emacs='emacs -nw'
alias cmake-eclipse='cmake -G "Eclipse CDT4 - Unix Makefiles"'
alias ccmake-eclipse='ccmake -G "Eclipse CDT4 - Unix Makefiles"'
@yuya-oc
yuya-oc / observer.cpp
Created September 17, 2012 04:17
MRPT Event observer sample
#include <iostream>
#include <mrpt/utils.h>
#include <mrpt/gui.h>
class EventObserver : public mrpt::utils::CObserver{
protected:
virtual void OnEvent(const mrpt::utils::mrptEvent &e){
if(e.isOfType<mrpt::gui::mrptEventMouseDown>()){
const mrpt::gui::mrptEventMouseDown *ev = e.getAs<mrpt::gui::mrptEventMouseDown>();