Skip to content

Instantly share code, notes, and snippets.

View HAKASHUN's full-sized avatar
🍊
みかん食べてる

HAKASHUN HAKASHUN

🍊
みかん食べてる
View GitHub Profile
@HAKASHUN
HAKASHUN / javascript_resources.md
Last active August 29, 2015 14:07 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage
@HAKASHUN
HAKASHUN / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
npm install -g yo
@HAKASHUN
HAKASHUN / gist:582a39161de244c407be
Created September 23, 2014 14:28
a sample grunt init config for grunt-file-exist
grunt.initConfig({
file_exist: {
options: {
output: 'reports/log.txt' //Where the log is output.
},
your_target: {
options: {
patterns: ['l.png', 'm.png', 's.png']
},
src: [
@HAKASHUN
HAKASHUN / gist:f3acef28e1ba9806c99f
Created September 23, 2014 14:27
a sample directory structure
img/thumbs
├── 0001_bird
│   ├── l.png
│   ├── m.png
│   └── s.png
├── 0002_dog
│   ├── l.png
│   ├── m.png
│   └── s.png
└── 0003_cat
@HAKASHUN
HAKASHUN / gist:011ac9b76d41c54dea7b
Last active August 29, 2015 14:05
createjsのFPS計る
//DOM生成
var ele = document.createElement("div");
ele.id = 'fpsMeter';
ele.style.position = 'fixed';
ele.style.background = 'rgba(0,0,0,.7)';
ele.style.top = '10px';
ele.style.left = '10px';
ele.style.padding = '10px';
ele.style['z-index'] = 99999;
ele.style['border-radius'] = '5px';
@HAKASHUN
HAKASHUN / gist:a441652aa985cd8e62b5
Last active August 29, 2015 14:03
肥大化した$routeProvider定義を解決する
// gacha module
var Gacha = angular.module('gacha', []);
var config = function($routeProvider, $injector) {
$routeProvider.
when('/', {
templateUrl: 'templates/gacha/index.html',
controller: 'IndexCtrl',
controllerAs: 'ctrl',
resolve: $injector.get('IndexResolver')
@HAKASHUN
HAKASHUN / gist:68c93bbc99dcb5aeec8f
Created June 28, 2014 10:35
肥大化した$routeProvider定義
$routeProvider.
when('/hoge', {
templateUrl: 'hoge.html',
controller: 'HogeCtrl',
controllerAs: 'ctrl',
resolve: {
data: [function(){
// ここで色々書く
}]
}
@HAKASHUN
HAKASHUN / gist:cbc1334b70b1c54d9b93
Created June 26, 2014 10:46
Javascriptで部分一致評価
var target = 'hoge';
var search = 'og';
if(target.indexOf(search) != -1) {
console.log('部分一致');
} else {
console.log('部分一致ではない');
}
function Convert(number, fromUnit) {
var conversions = {
distance : {
meters : 1,
cm : 0.01,
feet : 0.3048,
in : 0.0254,
yards : 0.9144
},
volume : {