Skip to content

Instantly share code, notes, and snippets.

View yomotsu's full-sized avatar

Akihiro Oyamada yomotsu

View GitHub Profile
@yomotsu
yomotsu / ua.js
Created January 18, 2013 09:40 — forked from Takazudo/ua.js
/* UA detection */
var ua = ( function () {
var ua = {};
var navigator = window.navigator;
var platforms = [
{
identity : 'ie9',
regex : [
{ property : 'userAgent', characters : /MSIE 9\./ }
@yomotsu
yomotsu / events.js
Last active December 11, 2015 18:38 — forked from Takazudo/events.js
/* eventmodule */
/* EventsClass for extend */
var EventModule = function () {}
EventModule.prototype.on = function ( evName, callback ) {
var _this = this;
if ( !this._observer ) {
this._observer = $( {} );
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break
.wordbreak{
-ms-word-break: break-all;
word-break: break-all;
// Non standard for webkit
word-break: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
hyphens: auto;
}
function convertLatLonToVec3 ( lat, lon ) {
lat = lat * Math.PI / 180.0;
lon = -lon * Math.PI / 180.0;
return new THREE.Vector3(
Math.cos( lat ) * Math.cos( lon ),
Math.sin( lat ),
Math.cos( lat ) * Math.sin( lon ) );
}
marker.position = convertLatLonToVec3( lat, lon ).multiplyScalar( earthRadius );
@yomotsu
yomotsu / gist:7891341
Created December 10, 2013 14:23
fizzbuzz w/o 'if'
var c = document.createElement( 'canvas' );
c.width = 100;
c.height = 1000;
document.body.appendChild( c );
var ctx = c.getContext( '2d' );
ctx.font = '10px';
for ( var i = 0; i < 100; i ++ ) {
ctx.save();
ctx.fillText( ( i + 1 ), 0, i * 10 + 10 );
@yomotsu
yomotsu / rename.py
Last active March 24, 2022 14:14 — forked from edom18/rename.py
import bpy
for obj in bpy.data.objects:
obj.name = 'obj'
for mesh in bpy.data.meshes:
mesh.name = 'mesh'
for armature in bpy.data.armatures:
armature.name = 'arm'
$.Deferred().resolve()
.then( function () {
var d = new $.Deferred();
setTimeout( function () {
console.log( 1 );
d.resolve();
}, 1000 );
return d;
} )
.then( function () {
uniform vec2 u_resolution;
// 1
// +-----+-----+
// | | |
// -ar +-----+-----+ ar
// | | |
// +-----+-----+
// -1
float aspectRatio = u_resolution.x / u_resolution.y;
http://codepen.io/yomotsu/pen/ZGrJJN
<style>
span.select{
position: relative;
white-space: nowrap;
box-sizing: border-box;
display: inline-block;
max-width:100%;
overflow: hidden;