Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
nishinoshake / cursor.css
Created December 5, 2015 11:48
カーソルを画像にする
#Container,
#Container a:hover {
cursor: url('../images/pointer.png'),
url('images/pointer.cur'),
default;
}
@nishinoshake
nishinoshake / multiple_bg.css
Last active May 29, 2016 05:16
CSSで背景を複数指定する
.bg {
background-image: url(""), url("");
background-repeat: no-repeat, repeat;
background-position: bottom right, center center;
}
@nishinoshake
nishinoshake / remove_style.js
Last active May 29, 2016 04:44
jQueryでCSSのスタイルを消す
//ひとつ
$('box').css('height', '');
//すべて
$('box').removeAttr('style');
@nishinoshake
nishinoshake / preLoad.js
Last active August 18, 2016 06:19
jQueryで画像のプリロード
var loadImage = function(img) {
var defer = new $.Deferred();
$(img).on('load', function() {
defer.resolve(this);
}).each(function() {
if ( this.complete ) {
defer.resolve(this);
}
});
return defer.promise();
@nishinoshake
nishinoshake / name_event.js
Last active May 29, 2016 04:43
jQueryでイベントに名前をつける
$(".button").on("click.sub", function(){});
$(".button").off("click.sub")
@nishinoshake
nishinoshake / youtube_iframe.html
Last active October 16, 2016 14:35
Youtubeの埋め込みiframe
<iframe width="560" height="315" src="https://www.youtube.com/watch?v=ehzyQvUUcUo?controls=0&showinfo=0&autoplay=1&rel=0&vq=highres" frameborder="0" allowfullscreen></iframe>
autoplay=0・・・自動で再生する(1)
loop=0・・・繰り返す(1)
showinfo=1・・・タイトルや評価などの情報を非表示(0)
controls=0・・・コントロールバー非表示
autohide=2・・・再生時にコントロールを自動的に隠す(1)、隠さない(0)、バーは隠すけど再生ボタンは表示(2)
theme=dark・・・プレイヤーの色が白(明るいグレー)になります(light)。
rel=1・・・関連動画を非表示に(0)
vq=highres・・・動画を一番高い高い画質
@nishinoshake
nishinoshake / social_share.js
Last active June 1, 2016 06:10
jQueryでFacebook,Twitter,LINEのシェア設定
/**
* == SNSボタンでシェア ==
* @constructor
*/
Index.Social = function() {
var elm = {
$twitter : $('.twitter a'),
$facebook: $('.facebook a'),
$line : $('.line a'),
$hatena : $('.hatena a')
@nishinoshake
nishinoshake / hosts
Last active May 29, 2016 04:40
apacheにバーチャルホスト設定
127.0.0.1 local.jp
@nishinoshake
nishinoshake / getLanguage.js
Last active May 29, 2016 04:49
JSでブラウザの言語を取得する
/**
* getLangage
*
* ブラウザに設定されている言語コードを返す
* 例. ja(日本), en(英語), zh(中国), zh-tw(台湾), ko(韓国)
* @returns {string} 言語コードを小文字で
*/
_self.getLanguage = function( ){
return (window.navigator.userLanguage ||
window.navigator.language ||
@nishinoshake
nishinoshake / sendMessage.php
Last active May 29, 2016 04:49
PHPからSlackにメッセージ
<?php
$slackApiKey = 'wowowowowowowowowowowowowoow';
$text = 'API TEST!';
$text = urlencode($text);
$url = "https://slack.com/api/chat.postMessage?token=${slackApiKey}&channel=%23api&text=${text}&as_user=true";
file_get_contents($url);