Skip to content

Instantly share code, notes, and snippets.

View ujiro99's full-sized avatar

ujiro99 ujiro99

  • japan
View GitHub Profile
@ujiro99
ujiro99 / designer.html
Created September 6, 2014 08:28
designer
<link rel="import" href="../polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
angular.module('jobFoundryDirectives').directive 'spy', ($location) ->
restrict: "A"
require: "^scrollSpy"
link: (scope, elem, attrs, scrollSpy) ->
attrs.spyClass ?= "current"
elem.click ->
scope.$apply ->
$location.hash(attrs.spy)
@ujiro99
ujiro99 / analytics.coffee
Last active January 1, 2016 22:19
AngularJSでGoogle Analyticsを使うためのシンプルなServiceとDirective.
angular.module('analytics', [])
.factory 'Analytics', ['$log', ($log) ->
_service = null
_tracker = null
return {
###*
Set parameter, and initialize.
# 現在のユーザー名とホスト名をタイトルに
$global:currentuser = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$user_and_host = ($currentuser.name -replace "(.*?)\\(.*?)$", "`$2@`$1")
$Host.UI.RawUI.WindowTitle = $user_and_host + " - Windows PowerShell"
# プロンプトのカスタマイズ
function prompt {
write-host ""
# ディレクトリの表示 (バックスラッシュをスラッシュに変換)
@ujiro99
ujiro99 / charset.coffee
Created May 18, 2013 06:50
Node.jsで、取得したWebページをUTF-8へ自動変換する ref: http://qiita.com/items/648a9400e8b25d717b1e
{Iconv} = require "iconv"
{Buffer} = require "buffer"
# エンコーディングの判別
getCharset = (body) ->
bin = body.toString('binary')
re = bin.match(/<meta\b[^>]*charset=["']?([\w\-]+)/i)
if re
charset = re[1]