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 / remove-utm.js
Created October 1, 2011 02:17
utmのパラメータをURLから取り除くブックマークレット
/**
* Remove utm parameters from url
* ( Use this as bookmarklet )
*/
(function(){
var loc, search, params, i;
loc = location;
search = loc.search.replace( /^\?/, '' ).split( '&' );
params = [];
i = search.length;
@mach3
mach3 / MY_Services_twitter.php
Created October 17, 2011 10:43
Servces_Twitterを拡張して定義ファイルを追加で読み込めるようにする。
<?php
require_once( "Services/Twitter.php" );
class MY_Services_twitter extends Services_twitter {
public function __construct(){
parent::__construct();
}
@mach3
mach3 / facebook_fangate.php
Created January 5, 2012 18:47
Fangate class for facebook.
<?php
/**
* Facebook fangate class
*
* @example
* $fangate = new Facebook_Fangate();
* $fangate->setSecret( $your_application_secret );
* $fangate->parse();
* $fangate->isLiked(); // true if the page is liked
@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 / getliked.php
Created January 9, 2012 11:30
ページがLikedかどうかを得るだけの簡単な関数
<?php
/**
* likedを得るだけの簡単な関数
*/
function getLiked(){
$signed_request = isset( $_POST["signed_request"] ) ? $_POST["signed_request"] : null;
$json = json_decode( base64_decode( array_pop( explode( ".", $signed_request ) ) ) );
if( isset( $json->page ) && isset( $json->page->liked ) ){
return $json->page->liked;
@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")));