Skip to content

Instantly share code, notes, and snippets.

#!ruby
# -*- coding: utf-8 -*-
require 'open-uri'
puts open('http://holiday.fjord.jp/').read.match(%r!<div class="next-holiday">\s*?(\d+月\d+日)\s*?<span>(.*?)</span>!)[1,2].join(' ')
@stephanschubert
stephanschubert / cross-browser-background-rgba.scss
Created April 18, 2011 05:44
SCSS mixin for cross-browser background-color: rgba(...). You'll need the Ruby extension for convenient color conversion rgba->hex (IE uses ARGB)
@mixin background-rgba($r,$g,$b,$a) {
// To mimic this in Internet Explorer, you can use the proprietary filter
// property to create a gradient with the same start and end color, along
// with an alpha transparency value.
@if experimental-support-for-microsoft {
$color: ie_hex($r,$g,$b,$a);
$value: unquote("progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=##{$color},endColorstr=##{$color})");
background-color: transparent\9;
@makenosound
makenosound / eleven40.scss
Created July 18, 2011 01:04
SASS plugin for Andy Taylor's 1140 grid
$eleven40-grid-width: 4.85% !default; // The width of a column
$eleven40-grid-margin: 3.8% !default; // The amount of margin between columns
@mixin eleven40-container {
padding-left: 20px;
padding-right: 20px;
}
@mixin eleven40-row {
margin: 0 auto;
@psebborn
psebborn / countCSSRules.js
Last active April 25, 2023 11:43
Count the number of rules and selectors for CSS files on the page. Flags up the >4096 threshold that confuses IE
function countCSSRules() {
var results = '',
log = '';
if (!document.styleSheets) {
return;
}
for (var i = 0; i < document.styleSheets.length; i++) {
countSheet(document.styleSheets[i]);
}
function countSheet(sheet) {
@sanxac
sanxac / scss2sass.sh
Created March 15, 2012 20:45
convert scss files to sass and delete .scss files in a directory
#!/bin/bash
for f in *.scss; do sass-convert $f ${f%scss}sass ; done
rm *.scss
@chriseppstein
chriseppstein / filters.sass
Created June 6, 2012 20:40 — forked from DeviaVir/filters.sass
Filters SASS
@mixin filter( $var )
-webkit-filter: $var
-moz-filter: $var
-ms-filter: $var
-o-filter: $var
filter: $var
a
&.on
@include filter( sepia(100%) hue-rotate(33deg) contrast(69%) unquote("saturate(2)"))
@komiya-atsushi
komiya-atsushi / week_of_month.rb
Created August 6, 2012 01:57
指定された日付が、その月において何週目にあたるのかを計算する Ruby のメソッド
require 'date'
#
# 指定された日付が、その月において何週目にあたるのかを計算し、返却します。
#
# 週始まりは月曜です。初週を 1 としています。
#
def week_of_month(date)
first_week = (date - (date.day - 1)).cweek
this_week = date.cweek
@jugyo
jugyo / gist:3521894
Created August 30, 2012 02:56
Vagrant の使い方
@Gab-km
Gab-km / github-flow.ja.md
Last active October 29, 2024 10:17 — forked from juno/github-flow.ja.md
GitHub Flow (Japanese translation)
@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