Skip to content

Instantly share code, notes, and snippets.

@pingyen
pingyen / jsIframe.html
Last active August 29, 2015 21:25
Put JS into Iframe
<iframe id="_if1" scrolling="no" style="width : 100%" ></iframe>
<script>
(function() {
var oIf = document.getElementById('_if1'),
win = oIf.contentWindow,
doc = win.document;
doc.write('<html><head></head><body><script src="http://postpet.jp/webmail/blog/clock_v1_moco.js" ></sc' + 'ript><body></html>');
if(doc.all) {
var scArr = doc.getElementsByTagName('script'),
@pingyen
pingyen / jsIframe2.html
Last active August 29, 2015 21:25
Put JS into Iframe 2
<iframe id="_if2" scrolling="no" style="width : 100%" ></iframe>
<script>
(function() {
var oIf = document.getElementById('_if2'),
win = oIf.contentWindow,
doc = oIf.contentWindow.document;
doc.write('<html><head></head><body><script src="http://www.lucido-l.jp/blogparts/parts.js" ></sc' + 'ript>');
if(doc.all) {
@pingyen
pingyen / jsIframe3.html
Last active August 29, 2015 21:25
Put JS into Iframe 3
<iframe id="_if3" scrolling="no" style="width : 100%" ></iframe>
<script>
(function() {
var oIf = document.getElementById('_if3'),
win = oIf.contentWindow,
doc = oIf.contentWindow.document;
doc.write('<html><head></head><body><script> google_ad_client = "pub-1821434700708607"; google_ad_slot = "8156194155"; google_ad_width = 200; google_ad_height = 200; </sc' + 'ript><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></sc' + 'ript>');
if(doc.all) {
@pingyen
pingyen / plurkBot.php
Last active October 20, 2018 22:14
Plurk Bot
<?php
define('NICKNAME', 'abc');
define('PASSWORD', 'iamabc');
define('USER_ID', '123456');
$message = 'Hello World!';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookie.txt');
@pingyen
pingyen / jsFuncCall.html
Last active August 30, 2015 02:15
JavaScript Function Call Performance Test
<html>
<head>
</head>
<body>
<script>
var i,
max = 10000000;
for(i = 0; i < max; ++i);
@pingyen
pingyen / plurkBot2.php
Last active June 29, 2017 11:11
Plurk Bot with Reply
<?php
define('NICKNAME', 'abc');
define('PASSWORD', 'iamabc');
define('USER_ID', '123456');
$message = 'Hello World!';
$reply = 'I am ABC!';
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@pingyen
pingyen / twd97Conv.php
Last active April 30, 2023 15:47
Transform TWD97 to Latitude Longitude
<?php
function twd97_to_latlng($x, $y) {
$a = 6378137.0;
$b = 6356752.314245;
$lng0 = 121 * M_PI / 180;
$k0 = 0.9999;
$dx = 250000;
$dy = 0;
$e = pow((1 - pow($b, 2) / pow($a, 2)), 0.5);
@pingyen
pingyen / base.js
Created September 20, 2012 10:04
WinJS base.js
/// <loc filename="Metadata\base_loc_oam.xml" format="messagebundle" />
/*!
© Microsoft. All rights reserved.
This library is supported for use in Windows Store apps only.
Build: 1.0.9200.20498.win8_ldr.120817-1716
Version: Microsoft.WinJS.1.0
*/
@pingyen
pingyen / ui.js
Created September 20, 2012 10:06
WinJS.UI ui.js
This file has been truncated, but you can view the full file.
/// <loc filename="Metadata\ui_loc_oam.xml" format="messagebundle" />
/*!
© Microsoft. All rights reserved.
This library is supported for use in Windows Store apps only.
Build: 1.0.9200.20498.win8_ldr.120817-1716
Version: Microsoft.WinJS.1.0
*/
@pingyen
pingyen / jsConsoleCustom.js
Last active December 11, 2015 04:38
JavaScript Console Customization
(function() {
var arr = ['log', 'error', 'info', 'warn', 'trace'],
n = arr.length;
for(var i = 0; i < n; ++i) {
(function(k) {
var f = console[k];
console[k] = function() {
var arr = Array.prototype.slice.call(arguments);