Skip to content

Instantly share code, notes, and snippets.

View mach3's full-sized avatar
🏠
Working from home

まっは mach3

🏠
Working from home
View GitHub Profile
@mach3
mach3 / reloadbutton.php
Created January 9, 2012 11:11
Reload button on facebook page.
<?php
/**
* 開発中のFbページにリロードボタンを埋め込む
*/
echo <<<EOS
<form action="./" method="post" style="position:absolute;right:10px;top:10px;">
<input type="hidden" name="signed_request" value="{$_REQUEST["signed_request"]}" />
<input type="submit" value="reload" />
</form>
@mach3
mach3 / twitter_autoload.js
Created January 20, 2012 15:25
Twitter公式の「新しいツイート」をクリックするだけの簡単な仕事の係のJS
javascript:(function(a){setInterval(function(){var b=a(".js-new-tweets-bar");if(b.length){a(".js-view-toggler").hide().text(b.text().match(/\d+/)+" new tweets. "+(new Date()).toString().match(/\d+:\d+:\d+/)).fadeIn();b.trigger("click")}},1000)})(jQuery);
@mach3
mach3 / demo.html
Created February 4, 2012 16:54
Sprite animation plugin for jQuery
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
#box {
width:320px;
height:320px;
background-color:#222;
@mach3
mach3 / jquery.overlay.js
Created February 8, 2012 09:26
create overlay element by jQuery
$.extend($,{
getClientHeight : function(){
return window.innerHeight || document.documentElement.clientHeight;
},
getClientWidth : function(){
return window.innerWidth || document.documentElement.clientWidth;
},
extractNumber : function(str){
return Number(str.replace(/[^\d\.]/g, ""));
},
@mach3
mach3 / moveSelectionToNamedLayer.js
Created February 21, 2012 16:56
JavaScript for Fireworks CS5 to move selected items to new layers created with those names.
/**
* JavaScript for Fireworks CS5
* Move selected items to new layers created with those names.
*/
(function(){
var sel, dom, debug, i;
sel = fw.selection;
dom = fw.getDocumentDOM();
debug = [];
for(i=0;i<sel.length;i++){
@mach3
mach3 / jsdir.js
Created February 28, 2012 14:20
Get script directory with 1 line.
/**
* Get script directory
*/
var jsdir = (function(s){ return s[s.length-1].src.split("?")[0].replace(/[^\/]+?$/, ""); }(document.getElementsByTagName("script")));
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.macports.php-fastcgi</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/php-cgi</string>
@mach3
mach3 / beautify.js
Created June 8, 2012 03:40
nodeで動作するjsbeautifierのCUI
/**
* Beautify.js
*
* @author mach3
* @require opts, js-beautify
* @example
* node beautify.js [-w] [-t] [-e <encoding>] [-i] [-b] <target>
*/
var opts, fs, path, beautify;
@mach3
mach3 / getRandomString.js
Created August 28, 2012 16:44
ランダムな文字列を指定した文字列から生成
/**
* Get random string
* @param String map
* @param Integer min length
* @param Integer max length
*/
var randomString = function(map, min, max){
var str, len;
len = Math.floor(Math.random() * (max - min) + 1) + min;
str = "";
@mach3
mach3 / shadowcanvas.js
Created October 8, 2012 10:23
ShadowCanvas : Drawing illustration with css box-shadow
/**
* ShadowCanvas
*
* Drawing illustration with css box-shadow
*
* @version 0.9
* @author mach3ss
* @require jQuery
*/
var ShadowCanvas = function(selector, option){