Skip to content

Instantly share code, notes, and snippets.

@ysakmrkm
ysakmrkm / gist:1851561
Created February 17, 2012 07:33
Get Google+ my account data
/*
First time, You need access here, and need configure about API Access.
https://code.google.com/apis/console/b/0/
Next , access here
https://accounts.google.com/o/oauth2/auth?redirect_uri=Uri_you_like_this_code_wirtten&response_type=code&client_id=Your_Client_ID&approval_prompt=force&scope=https://www.googleapis.com/auth/plus.me&access_type=offline
*/
$encoding = 'UTF-8';
@ysakmrkm
ysakmrkm / gist:2341160
Created April 9, 2012 03:20
Pure css image rollover mixins
@mixin rover($width,$height,$bg,$ext:'gif',$color:''){
@if $bg != '' {
@if $color != '' {
background:url('../img/' + $bg + '.' + $ext) left top no-repeat $color;
} @else {
background:url('../img/' + $bg + '.' + $ext) left top no-repeat;
}
}
a {
@ysakmrkm
ysakmrkm / gist:2418553
Created April 19, 2012 04:20
Common variables
@function margin($margin,$lheight,$base){
@return $margin + (((1 - (($lheight) / $base)) / 2) * $base);
}
@function pxtoem($target,$base){
@return ($target / $base)+em;
}
@function emtopx($target,$base){
@return ($target * $base)+px;
@ysakmrkm
ysakmrkm / gist:2651657
Created May 10, 2012 07:23
Background mixin
@mixin background($path:'',$pos1:'',$pos2:'',$repeat:'',$color:''){
@if $path != '' {
$path:url(#{$path});
} @else {
$path:'';
}
@if $pos1 != '' {
$pos1:' #{$pos1}';
}
@ysakmrkm
ysakmrkm / gist:3051844
Created July 5, 2012 06:42
Set element top/bottom margin without line-height minus margin
@function margin($margin,$lheight,$base,$unit:0){
@if $unit != 0 {
@return ($margin + (((1 - (($lheight) / $base)) / 2) * $base))+px;
} @else {
@return ($margin + (((1 - (($lheight) / $base)) / 2) * $base));
}
}
@ysakmrkm
ysakmrkm / gist:3134999
Last active October 7, 2015 08:28
Dummy text
@function dummytext($length:0,$lang:'ja'){
$base:'';
@if $lang == 'ja' {
$base:こ こ に 文 章 が 入 り ま す 。;
} @else if $lang == 'en' {
$base:t h i s \ i s \ d u m m y \ t e x t \.;
}
$text:'';
$num:floor($length / length($base));
$rest:$length % length($base);
@ysakmrkm
ysakmrkm / gist:3366433
Created August 16, 2012 03:48
Get site URL
var href = location.href.split('/');
var path = '';
var localRegex = /^\d+\.\d+\.\d+\.\d+/; //Local IP Address
var workRegex = /^.*\/pc\/[^\/]+\/.*$/; //Change regex if you want.
for(i = 0 ; i < href.length ; i++){
if(href[i] == '' || i == href.length - 1 && href[i].indexOf('.') !== -1){
href.splice(i,1);
}
@ysakmrkm
ysakmrkm / placeholder.md
Last active December 10, 2015 20:58
SassのPlaceholderで、親参照セレクタ(&)の前にセレクタを記述すると、意図しない展開が行われる。
%clearfix {
	&:before ,
	&:after {
		content:"";
		display:table;
	}

	&:after {
		clear:both;

}

@ysakmrkm
ysakmrkm / gist:5537473
Last active December 17, 2015 02:39
Movable Typeで、同一フォルダ内の前後ファイルページ送りを実現
<$mt:pagebasename setvar="bname"$>
<ul>
<mt:pagefolder>
<mt:pages sort_by="created_on" sort_order="ascend">
<mt:if tag="pagebasename" eq="$bname">
<$mt:getvar name="__counter__" setvar="pagenum"$>
</mt:if>
</mt:pages>
@ysakmrkm
ysakmrkm / config.rb
Created May 15, 2013 14:13
Compass設定ファイル
# Require any additional compass plugins here.
require 'ruby-growl'
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"