Skip to content

Instantly share code, notes, and snippets.

View potato4d's full-sized avatar
💭
It's not so easy to be consistent

Takuma HANATANI potato4d

💭
It's not so easy to be consistent
View GitHub Profile
@potato4d
potato4d / radwimps.php
Last active February 22, 2017 05:00
RADWIMPSで学ぶ再帰関数 「(前)\1{1,}世」から探し始めよう ref: http://qiita.com/potato4d/items/e3905927670787b34946
<?php
function prev_life($count){
$life = "";
for ($i=0; $i < $count; $i++) {
$life .= "前";
}
return $life;
}
@potato4d
potato4d / Response.php
Last active October 5, 2016 07:19
雑Router(ちゃんとしたい)
<?php
namespace Utilitys;
class Response
{
private static $instance;
/**
* getInstance
*
@potato4d
potato4d / style.css
Last active December 20, 2018 01:27
CSS3でWebサイト上のナビゲートに使える「くり抜き(スポットライト)」を実装する ref: https://qiita.com/potato4d/items/3db5be441d89ea448c3c
.spotlight{
position: absolute;
left: 0;
top : 0;
width: 100vw;
height: 100vh;
background: radial-gradient(transparent, transparent 100px, rgba(0,0,0,0.4) 100px, rgba(0,0,0,0.4));
@potato4d
potato4d / electron-fix.js
Created November 15, 2016 07:25
ElectronのWebviewにexecuteJavaScriptを利用した場合のコールバックについて ref: http://qiita.com/potato4d/items/9261908aba01f29c6f5f
const $ = e=>document.querySelector(e);
const webview = $("webview");
webview.addEventListener("did-stop-loading", ()=>{
webview.executeJavaScript(
`color:{$("#col_channels_bg").css("backgroundColor")}`,
false,
function(color){
console.log(color); // rgb(100, 100, 100);
// 決してcolor.colorではなく、colorでアクセスすることになるので注意
}
@potato4d
potato4d / main.js
Created November 16, 2016 10:05
Electronでタイトルバーを非表示にしつつウィンドウの操作ボタンを表示する方法 ref: http://qiita.com/potato4d/items/7cf11b75176cb355f364
function createWindow () {
// Create the browser window.
--- mainWindow = new BrowserWindow({width: 800, height: 600})
+++ mainWindow = new BrowserWindow({titleBarStyle: 'hidden',width: 800, height: 600})
@potato4d
potato4d / Greeting.spec.js
Created December 9, 2016 15:01
Vue.js Vueコンポーネントのユニットテストを書いてみよう ref: http://qiita.com/potato4d/items/8215941b84c11b845886
import Vue from 'vue'
import Greeting from 'src/components/Greeting.vue'
function getInstance (Component, propsData) {
const Ctor = Vue.extend(Component)
const vm = new Ctor({ propsData }).$mount()
return vm
}
describe('Greeting.vue', () => {
@potato4d
potato4d / bookmarklet.js
Created December 13, 2016 10:07
Wantedlyで応援をお願いされた時にまとめてクリックするブックマークレット
javascript:document.querySelectorAll(`#suggest-supports-of-friend-companies-form .support-project-title.with_avatar > input[type="checkbox"]`).forEach(e=>e.click());
@potato4d
potato4d / oauth.js
Last active December 14, 2016 15:43
electron-oauth-twitterでElectronでのTwitter OAuth認証を手軽に行う ref: http://qiita.com/potato4d/items/a4a2c9cb5667135f0748
const dialog = require('electron').dialog;
const OauthTwitter = require('electron-oauth-twitter');
const twitter = new OauthTwitter({
key : "YOUR_TWITTER_KEY",
secret: "YOUR_TWITTER_SECRET",
});
twitter.startRequest()
@potato4d
potato4d / .bashrc
Last active December 20, 2018 01:27
「ちょっと確認」のHTTPサーバー起動にはpocke/wwwが便利 ref: https://qiita.com/potato4d/items/56b359f1ab9ab932611e
alias http="open http://0.0.0.0:8080 & php -S 0.0.0.0:8080"
@potato4d
potato4d / fizzbuzz.js
Last active February 12, 2017 17:44
なんかTLではやってたので
Array(20).fill(0).map((_,i)=>i?((!(i%3)?"Fizz":'')+(!(i%5)?"Buzz":''))||i:0)