create rpm hello using rpmbuild.
docker build -t fedora -f ./fedora.dockerfile .
ocker run -it fedora /bin/bash
bash-4.3# hellow
bash: hellow: command not found
bash-4.3# hello
require 'rake' | |
require 'css_splitter' | |
desc 'split css files' | |
namespace :css do | |
task :split do | |
infile = ENV['infile'] || raise("missing infile") | |
outdir = ENV['outdir'] || File.dirname(infile) | |
max_selectors = ENV['max_selectors'] || 4095 |
check_css = lambda { |env| | |
node = env[:node] | |
node_name = env[:node_name] | |
# Don't continue if this node is already whitelisted or is not an element. | |
return if env[:is_whitelisted] || !node.element? | |
parent = node.parent | |
return unless node_name == 'style' || node['style'] | |
if node_name == 'style' | |
unless good_css? node.content | |
node.unlink |
Sometimes you just need to quickly take some notes.
A trick is to use the data:
scheme with data:text/html
to show just a piece of HTML in your browser.
Then using the mighty contentEditable
to make the whole thing editable.
To copy/paste into your browser address bar:
data:text/html,<html contenteditable>
# Our own variable where we deploy this app to | |
deploy_to = "/srv/example.com" | |
current_path = "#{deploy_to}/current" | |
shared_path = "#{deploy_to}/shared" | |
shared_bundler_gems_path = "#{shared_path}/bundler_gems" | |
# See http://unicorn.bogomips.org/Sandbox.html | |
# Helps ensure the correct unicorn_rails is used when upgrading with USR2 | |
Unicorn::HttpServer::START_CTX[0] = "#{shared_bundler_gems_path}/bin/unicorn_rails" |
# RSpec matcher for alias_method. | |
# https://gist.github.com/1950961 | |
# Usage: | |
# | |
# describe User do | |
# it { should alias_from(:username).to(:email) } | |
# end | |
RSpec::Matchers.define :alias_from do |alias_method| |
var Module = require('module'); | |
var vm = require('vm'); | |
var path = require('path'); | |
var filename = process.cwd() + '/lib/eval.js'; | |
var mod = new Module(filename); | |
var context = { | |
module: mod, | |
__filename: filename, |
(function (global) { | |
function clean(css) { | |
return css | |
.replace(/\/\*[\W\w]*?\*\//g, "") // remove comments | |
.replace(/^\s+|\s+$/g, "") // remove trailing spaces | |
.replace(/\s*([:;{}])\s*/g, "$1") // remove trailing separator spaces | |
.replace(/\};+/g, "}") // remove unnecessary separators | |
.replace(/([^:;{}])}/g, "$1;}") // add trailing separators | |
} |
/* | |
Load Sinon.JS in the SpecRunner: | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script> | |
<script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script> | |
<script type="text/javascript" src="sinon-1.0.0.js"></script> | |
<script type="text/javascript" src="sinon-ie-1.0.0.js"></script> | |
http://cjohansen.no/sinon/ | |
*/ |
//BASIC PIECES, 3 functions: unit, bind and the bind argument | |
//function unit(value) | |
//function bind(monad, function(value)) | |
//all three functions return a monad | |
/* The unit function is a constructor (returns a monad object) | |
* The magic is in the bind function | |
* | |
* There are AXIOMS: | |
* bind(unit(value)), f) === f(value) |