Skip to content

Instantly share code, notes, and snippets.

@sakunyo
sakunyo / README.md
Created May 18, 2012 04:55
getSearchQueries.js

#JavaScript .getSearchQueries

リクエストURLから?key=valueを抜き出し、objectを返す。

@sakunyo
sakunyo / OpacityOver.js
Created May 10, 2012 03:35
onOpacityOver
var OpacityOver = function(config){
this.ITEMS = config.ITEMS;
this.ITEMS.on("mouseover", this.onOpacityOver)
.on("mouseout", this.onOpacityOut);
};
OpacityOver.prototype = {
onOver: function(e){
$(this).stop().animate({
opacity: 0.6
@sakunyo
sakunyo / gist:2643507
Created May 9, 2012 10:04
grep images
ls
hoge.jpg
figure.png
bar.png
title.png
ls | grep 'jpg\|png' | sed -e 's/^/<img src="images\//' -e 's/$/" alt="" \/>/'
@sakunyo
sakunyo / gist:2641268
Created May 9, 2012 02:17
vim regex a
<a href="">foo/index.html</a>
<a href="">bar/index.html</a>
<a href="foo/index.html">foo/index.html</a>
<a href="bar/index.html">bar/index.html</a>
%s/href="">\([a-zA-Z0-9\/\.]*\)/href="\1">\1/
var foo = [
{ "id": 1, "alt": "Orange" },
{ "id": 2, "alt": "Apple" },
{ "id": 3, "alt": "Banana" }
],
item,
html;
for ( var i = 0, len = foo.length; i < len ; i++ ) {
item = foo[i];
@sakunyo
sakunyo / reset.css
Created January 10, 2012 07:16 — forked from terkel/reset.css
CSS Reset
/*!
* CSS Reset 2011-12-25
* https://gist.github.com/gists/1360380
*
* Author: Takeru Suzuki, http://terkel.jp/
* License: Public domain
*
* Inspired by Normalize.css: http://necolas.github.com/normalize.css/
*/
@sakunyo
sakunyo / gist:1484488
Created December 16, 2011 04:37
dataFormat()
function dataFormat(){
var t = "",
a = arguments,
i, l;
for( i = 0, l = a.length; i < l; i++ ){
if( a[i] !== undefined ){
if( a[i] === "" ){
t += '""';
}else{
@sakunyo
sakunyo / gist:1464097
Created December 12, 2011 01:33
Ext GridTable で Blankを常に下へ表示
Ext.override(Ext.util.Sorter, {
defaultSorterFn: function( o1, o2 ) {
var me = this,
transform = me.transform,
v1 = me.getRoot(o1)[me.property],
v2 = me.getRoot(o2)[me.property];
if (transform) {
v1 = transform(v1);
v2 = transform(v2);
{
text: "OK",
handler: function(){
var checked = Ext.ComponentQuery.query("#window checkboxfield[checked=true]");
var result = "";
Ext.each( checked, function( item ){
result += ""+
"label:"+ item.boxLabel +"<br />"+
"value:"+ item.inputValue +"<br />";
});