Skip to content

Instantly share code, notes, and snippets.

@artemave
artemave / gist:8714861
Last active August 29, 2015 13:55
css only spinner
//
// Spinner
// --------------------------------------------------
@import "variables";
@import "mixins";
.transform-mix (@deg, @delay) {
-webkit-transform: rotate(@deg) translate(0, -142%);
-webkit-animation-delay: @delay;
source 'https://rubygems.org'
gem 'capybara'
gem 'poltergeist'
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>text to music</title>
<script type="text/javascript" charset="utf-8" src="./zepto.min.js"></script>
</head>
<body>
<textarea name="" id= rows="40" cols="80"></textarea>
<button type="submit">Muse</button>
@artemave
artemave / gist:a1e454a1900f105196e8
Last active August 29, 2015 14:04
ruby threads and io
require 'benchmark'
def do_stuff
`sleep 0.1`
end
Benchmark.bm(10) do |x|
x.report("sequential") do
10.times { do_stuff }
end
@artemave
artemave / index.html
Last active August 29, 2015 14:07
This is a programming test for u_n_b_o_x_e_d. I am not telling you what it is doing, so that other candidates can't google it out.
<!DOCTYPE html>
<html>
<head>
<title>Unboxed test</title>
<meta charset="utf-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<style type="text/css" media="screen">
body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
@artemave
artemave / index.js
Last active August 29, 2015 14:20
requirebin sketch
sinon = require('sinon');
sinon.spy(window, 'WebSocket')
// throws an error (see console)
new window.WebSocket("ws://example.com")
var a = {
b: function() {}
}
// works
@artemave
artemave / SSH reverse tunnels
Created June 7, 2010 08:55
SSH reverse tunnels
# command line usage
local$ ssh -gR 8022:localhost:22 remote
remote$ scp -P 8022 file.tgz localhost:
# local ~/.ssh/config
Host remote
HostName remote.example.com
RemoteForward 8022 localhost:22
# remote ~/.ssh/config
desc "Tell app to use local gems and tweak bundler to not break with gems coming from git"
task :enable_local_gems_and_bundler do
run %(perl -pi -e 'print "ENV[\\"GEM_HOME\\"] = \\"/home/#{user}/.gems\\"\\nGem.clear_paths\\n" if $. == 1' #{release_path}/config/application.rb)
run "echo 'BUNDLE_PATH: /home/#{user}/.gems/bundler' >> #{release_path}/.bundle/config"
end
@artemave
artemave / gist:818678
Created February 9, 2011 15:43
find files with non-ascii content
#!/usr/bin/perl
use strict;
use warnings;
use File::Find;
File::Find::find(
sub {
return unless -f;
@artemave
artemave / gist:1006135
Created June 3, 2011 10:16
setup vnc server for any subsequent process (like cucumber -> firefox) to use vnc display
def _vnc_setup
d = '22' # vnc desktop number
ENV['DISPLAY'] = "localhost:#{d}"
hostname = `hostname`.chomp
vnc_pid_file = File.join(ENV['HOME'], ".vnc", "#{hostname}:#{d}.pid")
if File.exist?(vnc_pid_file)
pid = File.open(vnc_pid_file).read.chomp
log "Xvnc appears to be already running with pid #{pid}"
if `/bin/ps -p #{pid}`.split.last =~ /Xvnc/
return