Skip to content

Instantly share code, notes, and snippets.

View hrkd's full-sized avatar
🎯
Focusing

hrkd

🎯
Focusing
View GitHub Profile
@hrkd
hrkd / add_removeEvent.js
Created May 16, 2013 10:21
イベントの登録・解除をjQueryぽく。
Object.prototype.addEvent=function(type,func){
var tmpFnc = func;
eval("var "+type.split(".")[1]+"=tmpFnc");
this.addEventListener(type.split(".")[0], eval(type.split(".")[1]), false);
};
Object.prototype.removeEvent=function(type){
this.removeEventListener(type.split(".")[0], eval("this."+type.split(".")[1]), false);
};
//target.addEvent("click.name",function(){});
@hrkd
hrkd / getParm.js
Last active December 17, 2015 09:58
GETパラメータ取得
location.__proto__.getParm = (function(){
if(this.search){
var query = [];
var tmpQ = [];
query = location.search.replace("?","").split("&");
for(var i=0;i<query.length;i++){
tmpQ[query[i].split("=")[0]] = query[i].split("=")[1];
}
return tmpQ ? tmpQ : undefined;
@hrkd
hrkd / prototype.js
Created May 15, 2013 10:12
ちょっとずつ育てる。
Object.prototype.getId = function(id){
return document.getElementById(id);
};
Object.prototype.getTag = function(tag){
return document.getElementsByTagName(tag);
};
Object.prototype.addChild=function(tag){
this.appendChild(document.createElement(tag));
return this.childNodes;
};
@hrkd
hrkd / scss_for_loop.sass
Last active December 17, 2015 08:48
sassのループがすげべんり。
$ary : "a", "b", "c"
@for $i from 1 through length($ary)
$selecter : "id_"+nth($ary, $i)
div.#{$selecter}
require([
"somefile"
],function(){
//init function
});
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script data-main="js/app" src="./js/require.js"></script>
</head>
<body>
</body>
</html>
@hrkd
hrkd / centering.css
Created May 2, 2013 10:16
拾いモノ
.centering {
position: absolute;
margin: auto;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
@hrkd
hrkd / package.json
Created April 29, 2013 09:44
とりあえず動くver.
{
"name": "htdocs",
"version": "0.0.0",
"description": "ERROR: No README.md file found!",
"main": "index.js",
"dependencies": {
"grunt": "~0.4.1"
},
"devDependencies": {
"grunt": "*",
@hrkd
hrkd / Gruntfile.js
Last active December 16, 2015 18:49 — forked from anonymous/Gruntfile.js
var path = require('path');
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet;
var folderMount = function folderMount(connect, point) {
return connect.static(path.resolve(point));
};
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
grunt.initConfig({
@hrkd
hrkd / jsonloader.as
Created April 24, 2013 08:52
jsonを読み込んで完了をコールバックするクラス
package hrkd {
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import com.adobe.serialization.json.JSON;
public class jsonloader {
private var myLoader;
private var _func:Function;