Skip to content

Instantly share code, notes, and snippets.

@szimek
szimek / webgl-constants-by-name
Created January 3, 2011 21:28
WebGL context constants
ACTIVE_ATTRIBUTES: 35721
ACTIVE_ATTRIBUTE_MAX_LENGTH: 35722
ACTIVE_TEXTURE: 34016
ACTIVE_UNIFORMS: 35718
ACTIVE_UNIFORM_MAX_LENGTH: 35719
ALIASED_LINE_WIDTH_RANGE: 33902
ALIASED_POINT_SIZE_RANGE: 33901
ALPHA: 6406
ALPHA_BITS: 3413
ALWAYS: 519
-# Don't display new assets on form redisplay
- unless (form.object.new_record? && form.object.data.dirty?)
%li
= form.object.name if form.object.data?
= form.file_field :data if form.object.new_record?
= form.text_field :title
= remove_link(form, t('assets.actions.remove')).html_safe!
@szimek
szimek / server.js
Created May 12, 2011 07:06
Basic static files server + reverse proxy for XMPP BOSH in NodeJS
var util = require('util'),
express = require('express'),
httpProxy = require('http-proxy');
var app = express.createServer(),
proxy = new httpProxy.HttpProxy();
app.configure(function() {
app.use(express.static(__dirname + "/public"));
});
var SimplePeer = require('simple-peer')
// get video/voice stream
navigator.getUserMedia({ video: true, audio: true }, gotMedia, function () {})
function gotMedia (stream) {
var peer1 = new SimplePeer({ initiator: true })
var peer2 = new SimplePeer({ stream: stream })
peer1.on('signal', function (data) {
@szimek
szimek / clearfix.css
Created May 8, 2011 09:27
Facebook CSS
.clearfix {
display: block;
zoom: 1;
}
.clearfix::after {
clear: both;
content: ".";
display: block;
font-size: 0;
@szimek
szimek / presentation.md
Created January 24, 2012 09:51
HTTP caching in Rails

HTTP caching

Kinds of caches

  • Browser
  • Proxy
  • Gateway

TODO Difference between proxy and gateway caches.

Keybase proof

I hereby claim:

  • I am szimek on github.
  • I am szimek (https://keybase.io/szimek) on keybase.
  • I have a public key ASAyzYcb8io6Ck9sSwUL5PpHlKz1FgoJEFivGmR9wvuvAAo

To claim this, I am signing this object:

@szimek
szimek / a.md
Created June 29, 2012 11:03 — forked from rkh/a.md

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Netflix
  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
@szimek
szimek / capybara_select_dates_and_times.rb
Created August 31, 2010 09:26
Cucumber steps for selecting time and date (using Capybara)
require "xpath" # XPath is a separate gem now
module Cucumber
module Rails
module CapybaraSelectDatesAndTimes
def select_date(field, options = {})
date = Date.parse(options[:with])
selector = %Q{.//fieldset[contains(./legend, "#{field}")]}
within(:xpath, selector) do
find(:xpath, '//select[contains(@id, "_1i")]').find(:xpath, ::XPath::HTML.option(date.year.to_s)).select_option
@szimek
szimek / git-gpg.md
Last active January 29, 2018 20:00 — forked from bcomnes/git-gpg.md
my version of gpg on the mac
  1. brew install gnupg, pinentry-mac (this includes gpg-agent and pinentry)

  2. Generate a key: $ gpg --gen-key

  3. Take the defaults. Whatevs

  4. Tell gpg-agent to use pinentry-mac:

    $ vim ~/.gnupg/gpg-agent.conf