Skip to content

Instantly share code, notes, and snippets.

View megurock's full-sized avatar

Eiji Meguro megurock

  • Fork
  • Tokyo / Japan
View GitHub Profile
/**
*
*/
function doIEHack() {
var $fixNodes = $('.pngfix');
// appy filter for all image elements with a 'pngfix' class being attached
$fixNodes.filter('img').each(function() {
applyFilterOnNode($(this));
});
@megurock
megurock / ail-filter.js
Last active August 29, 2015 14:04
jquery plugin to appy AlphaImageLoader filter on transparent png images
/* global $, jQuery, window */
(function($) {
/**
*
*/
function applyFilterOnBackgroundImage($node, sizingMethod) {
var regex = /url\(["']*(.*?)["']*\)/;
var src = $node.css("background-image").replace(regex, "$1");
@megurock
megurock / test.js
Last active August 29, 2015 14:04
testing site title and description using nightwatch.js
module.exports = {
setUp: function() {
},
tearDown: function() {
},
myTest: function(browser) {
@megurock
megurock / get_result.php
Last active August 29, 2015 14:04
php example that returns jsonp
<?php
$callback = (isset($_GET['callback'])) ? $_GET['callback'] : 'callback';
$result = (isset($_GET['result'])) ? (int) $_GET['result'] : 0;
$error = (isset($_GET['error'])) ? (int) $_GET['error'] : 0;
$output = array(
"uid" => uniqid(),
"result" => $result,
"error" => $error
);
@megurock
megurock / Gruntfile.js
Last active August 29, 2015 14:07
My gruntfile template #1
'use strict';
// see http://qiita.com/shinnn/items/57327006390f2181f550
var licenseRegexp = /^\!|^@preserve|^@cc_on|\bMIT\b|\bMPL\b|\bGPL\b|\(c\)|License|Copyright|three\.js/mi;
var isLicenseComment = (function() {
var _prevCommentLine = 0;
return function(node, comment) {
if (licenseRegexp.test(comment.value) ||
comment.line === 1 ||
comment.line === _prevCommentLine + 1) {
_prevCommentLine = comment.line;
@megurock
megurock / package.json
Created October 1, 2014 12:08
package.json for my grunt template #1
{
"name": "application-name",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "3.4.8",
"jade": "*"
{
"exclude": [
".git/**",
"node_modules/**",
"bower_components/**"
],
"always-semicolon": true,
"block-indent": "\t",
"color-case": "lower",
"color-shorthand": true,
@megurock
megurock / pictuerfill-test.html
Created October 7, 2014 09:54
picturefill 1.2 exmaple
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Picturefill 1.2 Example</title>
<link rel="stylesheet" href="css/main.css">
<!--[if IE 9]><script src="js/vendor/matchMedia.js"></script><![endif]-->
<script src="js/vendor/picturefill.js"></script>
</head>
@megurock
megurock / gulpfile.js
Created November 24, 2014 16:47
will be updated.
// plugins
var gulp = require('gulp');
var del = require('del');
var webserver = require('gulp-webserver');
var sass = require('gulp-sass');
var pleeease = require('gulp-pleeease');
var changed = require('gulp-changed');
var usemin = require('gulp-usemin');
var uglify = require('gulp-uglify');
var minifyHtml = require('gulp-minify-html');
@megurock
megurock / csscomb-config.json
Created April 14, 2015 09:13
csscomb simple setting ver
{
"exclude": [
".git/**",
"node_modules/**",
"bower_components/**"
],
"always-semicolon": true,
"block-indent": "",
"color-case": "lower",
"color-shorthand": true,