Skip to content

Instantly share code, notes, and snippets.

@bob-lee
bob-lee / polyfill-ie11-nodelist-foreach.js
Created November 24, 2017 18:41
Polyfill for IE11 missing NodeList.forEach
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
@lunelson
lunelson / hsy.scss
Last active March 8, 2022 14:15
sRGB BT-709 Brightness (Luma) function and HSY() color function for Sass
// sRGB GAMMA CORRECTION, per spec: https://en.wikipedia.org/wiki/SRGB
@function re-gamma($n) { @if $n <= 0.0031308 { @return $n * 12.92; } @else { @return 1.055 * pow($n,1/2.4) - 0.055; } }
@function de-gamma($n) { @if $n <= 0.04045 { @return $n / 12.92; } @else { @return pow((($n + 0.055)/1.055),2.4); } }
// sRGB BT-709 BRIGHTNESS
@function brightness($c) {
$rlin: de-gamma(red($c)/255);
$glin: de-gamma(green($c)/255);
$blin: de-gamma(blue($c)/255);
@return re-gamma(0.2126 * $rlin + 0.7152 * $glin + 0.0722 * $blin) * 100;
@udzura
udzura / tutorial.md
Created June 2, 2014 03:31
Hubot + CoffeeScript ではじめるやわらかプログラミング入門

やわらかプログラミング入門

  • Hubot であそぼう


始めに、地図を描く

@melborne
melborne / atom_creating_a_package.ja.md
Created March 22, 2014 09:16
Atom.io Document Translations
@taea
taea / rm_pid.md
Last active January 12, 2023 14:22
postgres をちゃんと終了しないと.pidファイルが残っちゃって、Rails が起動しないもんだい

Rails 起動しようとするとこんなエラーでる

PG::ConnectionBad at /
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
@michaelparenteau
michaelparenteau / config.ru
Last active January 29, 2016 05:55
Basic Auth Middleman & Heroku
# This is a snippet to add to middleman's config.ru file if you want to add basic auth to your middleman app on heroku
# NOTE: you need to stick this above the build script like shown below
use Rack::Auth::Basic, "Restricted Area" do |username, password|
[username, password] == ['username', 'password']
end
# This part below is just what builds the static site. you only need to add lines 4 - 6 above any build command like shown below.
use Rack::TryStatic, :root => "build", :urls => %w[/], :try => ['.html', 'index.html', '/index.html']
みなさまRubyKaigiお疲れ様でしたー。素敵なKaigiに再会できてうれしかったです。
RubyKaigiまわりで、同じ分野の問題提起が二つありましたねぇ。
一つはKaigi中での、「台湾の女の子はKawaii、だからRubyKaigi Taiwanに来るべき」という発言、
それを笑いで迎えた場内に対して、女性への配慮が足りないだろうという意見。
https://gist.github.com/kyanny/5694201
もう一つは、続くRubyHirobaでの、ポルノに関しての情報処理技術についてのLTがあったこと。
(そして、実際にそれを聞いて傷ついた女性が存在し、問題が提起されました)
RubyhirobaはRubyKaigiとは独立した、せっかく東京にRubyistがたくさん居るんだから交流しよう!という、
LTとWorkshopと交流の場を提供するイベントです。
@mattdrose
mattdrose / _contrast-luma.scss
Last active March 8, 2022 14:16
Use SASS to get the contrast color based on a color's luma value (the Y in YIQ). http://en.wikipedia.org/wiki/YIQ This calculates a color that is much more readable. Read more from the W3C. http://www.w3.org/TR/AERT#color-contrast
/*
* Calculate Luma
*
* Luma measures a colors percieved brightness
* by the human eye.
* http://en.wikipedia.org/wiki/YIQ
*/
@function luma($color){
@mochiz
mochiz / gist:4736183
Last active April 16, 2023 03:56
rbenvとruby-buildでRuby環境を最新に保つ

rbenvとruby-buildでRuby環境を最新に保つ

更新日:2014/11/19

rbenv, ruby-buildを更新

$ cd ~/.rbenv
$ git pull origin master
$ cd ~/.rbenv/plugins/ruby-build
$ git pull origin master
@tcmacdonald
tcmacdonald / front_matter.rb
Created October 30, 2012 14:54
Pulling front matter from Rails views template.
require 'active_support/concern'
module FrontMatter
extend ActiveSupport::Concern
included do
helper_method :front_matter
end
def front_matter