Skip to content

Instantly share code, notes, and snippets.

@regepan
regepan / fancybox-css.css
Last active December 23, 2015 10:29
always visible arrows in fancybox by CSS.
#fancybox-left-ico {
left: -45px;
}
#fancybox-right-ico {
right: -45px;
left: auto;
}
.fancybox-nav span {
visibility:visible;
}
// &&
console.debug(true && true);// true
console.debug(true && false);// false
console.debug(false && true);// false
console.debug(false && false);// false
// ||
console.debug(true || true);// true
console.debug(true || false);// true
console.debug(false || true);// true
function Rectangle(w, h){
this.width = w;
this.height = h;
}
Rectangle.prototype.area = function(){
return this.width * this.height;
}
var r = new Rectangle();
// コンストラクタ
function Circle(radius){
// インスタンスプロパティ
this.r = radius;
}
// クラスプロパティ
Circle.PI = 3.14;
var c = new Circle(5.0);
@regepan
regepan / test.js
Last active December 30, 2015 07:59
// コンストラクタ
function Circle(){}
// インスタンスメソッド
Circle.prototype.area = function(val){ alert(val) };
// インスタンスを生成する
var c = new Circle();
function ImmutableRectangle(w){
this.getWidth = function(){
return w;
}
}
var r = new ImmutableRectangle(100);
console.debug(r.getWidth());// 100
function ImmutableRectangle(){}
ImmutableRectangle.prototype.getWidth = function(w){
console.debug('prototypeの定義だぜ', w);
}
var r = new ImmutableRectangle();
r.getWidth(100);
function ImmutableRectangle(){
this.getWidth = function(w){
console.debug('上書きできるぜ!');
}
}
ImmutableRectangle.prototype.getWidth = function(w){
console.debug('prototypeの定義だぜ', w);
}
var r = new ImmutableRectangle();
console.debug('正解!'.toString());// 正解!
String.prototype.toString = function(){
return 'toStringを上書きしました!';
}
console.debug('正解!'.toString());// toStringを上書きしました!
<?php
function remove_menu() {
global $menu;
var_dump($menu);// この中にremove_menu_page()に何を渡せばいいのかがわかる文字列が入っている。
remove_menu_page('index.php'); // ダッシュボードが消える。
}