Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

まっは mach3

🏠
Working from home
Block or report user

Report or block mach3

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mach3
mach3 / test.html
Created Feb 6, 2014
Test jQuery.EqualRowHeights
View test.html
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./jquery-1.10.2.min.js"></script>
<script src="../dest/jquery.equalrowheights.js"></script>
<script>
$(function() {
@mach3
mach3 / jquery-lineup.js
Last active Aug 29, 2015
test jquery-lineup update
View jquery-lineup.js
(function($){
/**
* LineUp
* ------
* Fix heights of the cols in the same row
*
* @class
* @param String selector
* @param Object option
@mach3
mach3 / grunt-phps.js
Created Mar 26, 2014
Grunt task to run php built-in server
View grunt-phps.js
/**
* Grunt Task : phps
* -----------------
* Run php built-in server
*/
module.exports = function(grunt) {
grunt.registerMultiTask("phps", "", function() {
var exec, cmd, options;
@mach3
mach3 / example.html
Last active Aug 29, 2015
jquery-multiline-overflow.js
View example.html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.demo {
height: 3em;
line-height: 1.5em;
overflow: hidden;
@mach3
mach3 / jquery.togglbuttons.js
Last active Aug 29, 2015
Polyfill to implement the toggle button by hidden radio input
View jquery.togglbuttons.js
/**
* Polyfill to implement the toggle button by hidden radio input
* Add "active" class to the buttonized element, for ":checked + el" expression
* @param {Object} options
*/
$.support.toggleButtons = "opacity" in document.createElement("div").style;
$.fn.toggleButtons = function(options){
var my = {};
if($.support.toggleButtons){
@mach3
mach3 / grunt-resolve-json.js
Created Jul 25, 2014
grunt-resolve-json.js: Load map.json and resolve paths
View grunt-resolve-json.js
module.exports = function(grunt){
var path = require("path"),
_ = grunt.util._;
/**
* Resolve dest and src files' path
* @param {String} file
* @returns {Object}
*/
View lottery.js
var lottery = function(data, rate, times){
var source = [];
rate = rate || (function(){
var i, rate;
i = data.length;
rate = [];
while(i--){
rate.push(1);
}
return rate;
@mach3
mach3 / ruby-mkpasswd.rb
Created Oct 23, 2010
[Ruby Excersize] Password Generator
View ruby-mkpasswd.rb
#!/usr/bin/ruby
class MkPasswd
def initialize
@defaultOption = {
'length' => 8,
'useNumeric' => true,
'useUpperCase' => true,
'useSymbol' => true
}
@mach3
mach3 / showfeed.rb
Created Nov 16, 2010
Note for getting remote RSS Feed with ruby
View showfeed.rb
#!/usr/bin/ruby
require "open-uri"
require "rss"
begin
rss = open( "<feed url here!>" ){ |f|
RSS::Parser.parse( f.read )
}
rss.channel.items.each{ |r|
@mach3
mach3 / domdocument.php
Created Dec 8, 2010
Create association array from xml, usin domdocument.
View domdocument.php
<?php
// for example, from RSS
$dom = DOMDocument::loadXML( $string_stored_xml );
$entries = array();
foreach( $dom->getElementsByTagname("item") as $item ){
$entry = array();
foreach( $item->childNodes as $node ){
if( $node->nodeType === 1 ){
$entry[ $node->nodeName ] = $node->nodeValue;
You can’t perform that action at this time.