Skip to content

Instantly share code, notes, and snippets.

@marushu
marushu / resize.js
Created October 19, 2016 10:56 — forked from wgkoro/resize.js
指定サイズ以内の画像幅、高さを算出、img要素にそのサイズを適用するスクリプト
/**
* 指定サイズ以内の画像幅、高さを算出、
* img要素にそのサイズを適用する
*
* 使い方:
*
* 例) 幅150px, 高さ200px以内で画像を表示する
* var img = document.createElement('img');
* img.src = 'http://hoge.com/img/fuga.jpg';
* imgResize.resize(img, 150, 200);
@marushu
marushu / 0_reuse_code.js
Created May 9, 2016 02:52
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
@marushu
marushu / gist:4199444
Created December 4, 2012 00:42 — forked from lucasfais/gist:1207002
ST2 Keybord Short Cuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@marushu
marushu / gist:1378425
Created November 19, 2011 04:05 — forked from miya0001/gist:1378387
指定された期限内の記事だけを取得する
<?php
/*
現在の日時から2日後のタイムスタンプを保存する
$d = 2 * 60 * 60 * 24; // 2日間
$expire = current_time('timestamp', get_option("gmt_offset")) + $d;
update_post_meta($post->ID, '_expire', $expire);