Skip to content

Instantly share code, notes, and snippets.

@haruair
haruair / dice_result.js
Created June 17, 2013 04:55
게임코디 주사위 결과정리 북마클릿
(function() {
var jq = document.createElement('script'); jq.type = 'text/javascript'; jq.async = false;
jq.src = '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(jq, s);
var dice_result_gen = function(){
if(jQuery("#dice_result").length != 0) return false;
var dice_img = jQuery("img[src^=\"/dice_\"]");
var list = [];
if(dice_img.length == 0) return false;
(function() {
var jq = document.createElement('script'); jq.type = 'text/javascript'; jq.async = false;
jq.src = '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(jq, s);
var giant_gamecodi = function(){
var giant_name = jQuery("#giant-name").val() || "진격의 고양이";
var giant_hp = parseInt(jQuery("#giant-hp").val()) || 730666;
function sshow_load_img1(src, loaded) {
/* NOT possible to document.createElement('canvas').getContext('2D').drawImage( img or img.get() ) */
var img = $("<img />").attr('src', src )
.load(function() {
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
alert('broken image!');
} else {
if (loaded) loaded(img);
}
});
@haruair
haruair / ratebutton.m
Created March 13, 2014 00:10
Rate Button
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=824136867"]];
@haruair
haruair / gist:9971560
Created April 4, 2014 09:58
GIt commit name update
git filter-branch -f --commit-filter '
if [ "$GIT_COMMITTER_NAME" = "old-name" ];
then
GIT_COMMITTER_NAME="new-name";
GIT_AUTHOR_NAME="new-name";
GIT_COMMITTER_EMAIL="email@domain.name";
GIT_AUTHOR_EMAIL="email@domain.name";
git commit-tree "$@";
else
@haruair
haruair / maps3.js
Created April 18, 2014 14:22
Daum map API v3 with DOM
(function (e, d) {
if (typeof d == "object") {
for (var f in d) {
if (d.hasOwnProperty(f)) {
e[f] = e[f] || d[f], arguments.callee(e[f], d[f]);
}
}
}
})(this, {
daum: {
@haruair
haruair / zipdeploy
Last active August 29, 2015 14:01
Git diff the extract as a zip file
#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H%M%S")
DIFF=$(git diff --name-only deploy HEAD)
TOPLEVEL=$(git rev-parse --show-toplevel)
CURRENT=$(pwd)
if [ -z "$DIFF" ]
then
echo "😝 Sorry no diff in there."
else
cd "$TOPLEVEL"
@haruair
haruair / Person.js
Last active August 29, 2015 14:02
defineProperty test
"use strict";
var Person = function(name){
var _name = name || "Unknown";
Object.defineProperty(this, "name", {
get: function(){ return "My name is " + _name; },
set: function(newvalue){ _name = newvalue; }
});
@haruair
haruair / scrapbook.php
Created October 4, 2014 15:40
Scrapbook plugin for Wordpress
<?php
/**
* @package Haruair
* @version 1.0
*/
/*
Plugin Name: Scrapbook
Description: scrapbook custom type plugin
Author: haruair
Version: 1.0
@haruair
haruair / chmoddefault
Created December 15, 2014 00:06
chmoddefault
#!/bin/bash
# put this file into /usr/bin
# set the file as correct permission
read -r -p "Are you sure? [y/N] " response
case $response in
[yY][eE][sS]|[yY])
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
;;
*)