Skip to content

Instantly share code, notes, and snippets.

ykhs ykhs

Block or report user

Report or block ykhs

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
@ykhs
ykhs / fizzbuzz.ls
Created Aug 30, 2012
fizzbuzz with LiveScript
View fizzbuzz.ls
global <<< require \prelude-ls
fizzbuzz = (x) ->
| x % 15 is 0 => \fizzbuzz
| x % 5 is 0 => \buzz
| x % 3 is 0 => \fizz
| otherwise => x
[1 to 100] |> map fizzbuzz |> each console.log
@ykhs
ykhs / _linear-gradient.scss
Created Sep 10, 2012
linear-gradient Sass Mixin
View _linear-gradient.scss
@mixin linear-gradient($angle, $color-stops...) {
$_angle-with-vendor-prefix: "";
$_angle: "";
@if $angle == "to top" or $angle == "bottom" {
$_angle-with-vendor-prefix: bottom;
$_angle: to top;
} @else if $angle == "to right" or $angle == "left" {
$_angle-with-vendor-prefix: left;
$_angle: to right;
} @else if $angle == "to bottom" or $angle == "top" {
@ykhs
ykhs / chapter6_list8.js
Last active Mar 9, 2017
JavaScript養成読本 特集1 第6章 リスト8 訂正
View chapter6_list8.js
// js/note_list_item.js
App.NoteListItemView = Backbone.View.extend({
tagName: 'tr',
render: function() {
var template = $('#noteListItemView-template').html();
var compiled = _.template(template);
var html = compiled(this.model.toJSON());
this.$el.html(html);
return this;
View peco_select_branch.fish
function peco_select_branch
set -l query (commandline)
if test -n $query
set peco_flags --query "$query"
end
git branch | peco --prompt "GIT BRANCH>" $peco_flags | sed -e "s/^\* //g" -e "s/^ //g" | read line
if [ $line ]
View fizzbuzz.js
Array.apply(null,Array(100)).map(function(i,j){++j;i='';!(j%3)&&(i='fizz');!(j%5)&&(i+='buzz');console.log(i||j)})
View domParse.js
domParse = function(htmlString) {
var doc;
doc = document.implementation.createHTMLDocument('');
doc.body.innerHTML = htmlString;
return doc.body.firstChild;
};
@ykhs
ykhs / colour_lovers_sass_palette.rb
Created Apr 7, 2013
www.colourlovers.com の palette を取得して Sass の変数定義の形へ整形
View colour_lovers_sass_palette.rb
require 'net/http'
require 'rexml/document'
class Palette
attr_accessor :name, :url, :colors
def initialize(id)
@name = String.new
@url = String.new
@colors = Array.new
@ykhs
ykhs / backcall-with-do-statement.ls
Created Aug 31, 2012
backcalls のスコープは `do` で制御できる
View backcall-with-do-statement.ls
do
<-! $
initializeApp!
data <-! $.get 'ajaxtest'
$ \.result .html data
processed <-! $.get 'ajaxprocess', data
$ \.result .append processed
@ykhs
ykhs / genPassword.js
Created Aug 9, 2012
generate password like string
View genPassword.js
var password = [].reduce.call('AaBbCcDdEeFfGgHhiJjKkLMmNnPpQqRrSsTtWwXxYyz3456789', function(p, c, i, a) {
return p += a.replace(new RegExp(p.split('').join('|'), 'g'), '')[Math.floor(Math.random() * (a.length - p.length))];
}, '').substr(0, 16);
console.log(password);
@ykhs
ykhs / gist:3027432
Created Jul 1, 2012
Shadow DOM Sample
View gist:3027432
<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
<!-- このスタイルは文書ツリー側に定義したものなので Shadow DOM 内部には適用されない。 -->
<style>
section.articleBox h1 {
color: black;
}
You can’t perform that action at this time.