Skip to content

Instantly share code, notes, and snippets.

.blink {
-webkit-animation-name: blinker;
-webkit-animation-duration: 1s;
-webkit-animation-timing-function: linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-name: blinker;
-moz-animation-duration: 1s;
-moz-animation-timing-function: linear;
-moz-animation-iteration-count: infinite;
it('should trigger an event when things are retrieved', function() {
var server = Sinon.fakeServer.create();
server.respondWith(/\/thing\/(\d+)/, function (xhr, id) {
xhr.respond(200, { "Content-Type": "application/json" }, JSON.stringify(new Thing({ id: id, text: 'Hello' })));
});
var ventInvoked = false;
vent.on('thingReceived', function(thing) {
expect(thing.get('id')).toEqual(123);
ventInvoked = true;
});
@anoras
anoras / dashboard_spec.rb
Created May 7, 2013 20:42
Strange intermittent failures with Capybara. Always fails on CI server, sporadically fails in development environment, but never at the same assertion as on the CI server. Any clues why?
describe 'dashboard' do
it 'should be possible to edit an item', js: true do
visit_subdomain 'bizeeme', '/dashboard/'
# The browser app creates the UI with Backbone.js when loaded...
within '#item-list' do # <- It allways fails on the CI server here, because "#item-list" doesn't exist.
find('a', text: /First/i).click
end
within '#content' do
fill_in 'description', with: 'Changed description!'
@anoras
anoras / gist:4655561
Last active December 11, 2015 20:28 — forked from spovich/gist:1848409
# Install with:
# bash < <(curl -L https://raw.github.com/gist/4655561)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-374 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@anoras
anoras / brute-force.js
Created June 26, 2012 21:59
Smart up this.
calculate_random_point: function(existing_points, min_angle, max_angle, plot_radius, point_radius) {
var angle = this.random_angle(min_angle, max_angle);
var point_radius = Math.random() * (plot_radius - (point_radius / 2));
var point = {
x: (Math.sin(angle) * point_radius),
y: (Math.cos(angle) * point_radius)
};
if (_.any(existing_points, function(existing_point) {
var distance = Math.sqrt(Math.pow(existing_point.x - point.x,2) + Math.pow(existing_point.y - point.y,2));
return distance < point_radius;
@anoras
anoras / installing express
Created June 18, 2012 10:45
WebStorm + NPM + not sudo
Snehvit:test anders$ npm install express
npm http GET https://registry.npmjs.org/express
npm http 200 https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/mime/1.2.4
npm http GET https://registry.npmjs.org/qs
npm http GET https://registry.npmjs.org/mkdirp/0.3.0
npm http GET https://registry.npmjs.org/connect
npm http 200 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/mime/1.2.4
npm http 200 https://registry.npmjs.org/mkdirp/0.3.0
@anoras
anoras / nevergonna.js
Created June 1, 2012 14:44
Never gonna give you up..
a="181U1c1f3X1d3Q3_1a3Y1_3d1]3^1Z3L1X3C1V393T1E1P1Q243V1N3a1J1K2Q331H3Z1F2R3A1C3K1?1@3R3W1=3b1;3M192S2V10152J133]113N3S1.3O1,3`1*380i3U0g3P0e310c3+3.";l=[];while(a.length){l.push((Y(a.charCodeAt(0))<<6)+Y(a.charCodeAt(1))-512);a=a.slice(2,a.length)}d="AgVU:,KZeB+DMR6RNOC+gA=c,HJb74d88M+D1/5//T9h9b3=1[8Xb0fJ0V8M^M-L`Bf+XA-ec,KIN1[G1Ld7J@-JV8-FXG9`.f0*_2EPT,c]/V9j1-M^*-:H<P05Rc=_@U1Cia=F+2jL07RebaKLeF/W;Za,].H]W>.:*_/G@KLeFX;f4`:;*-;81-/_V=Z2hODR2J+SA+0RX,_B5<a8`-KLd1VU?+.*71@i_6A;h;NH]W>.:*_8B_.;@90]9C@T,2*D-]>[RPiM+D8G:cBX:KI][@QZ.g.^9Q2:b7>j/>8432+29LeRdPRDZe1WJM9Q5J41X0Ji5OOD-2RFcD-416DA0KD+`fD9D1L0d9J3e9867BG-aZ:;A*>2.5iQZ.h+XD,Cb;JW1VVU:;*-;FOM<c_Ic5<je05R[b_G_F3e5?MVjE3X*NIgJ@-JgO6G_6A54_0;:gPc@J]Ka].H]W>.:*_/G@KLeFX;f4`:;*-;81-/_V=Z2hODR2J+SA+0RX,_B5<a8`-KLd1VU?+.*71@i_6A;h;NH]W>.:*_8B_.;@90]9C@T,2*D-]>[RPiM+D8G:cBX:Ma?TJL*0JUT_6A=O]9C@T,2*D3ZcBXOLH+1VU?+.*74c2`/Z@M+D@[aRF6A2hODR2J+RebaKLe9T6Ma?TJL*0K^0JL4[ca;f4`:;*-:H<P7.b_B5;^T1-/].5[i3[jJUT_6A=O^gKH9[89g/G@KLeFXIN5[i3[i;f4`:;*-:?`CjJC@T,2*D,XU2AYeeW-
@anoras
anoras / text
Created May 10, 2012 20:26
npm jsdom
Snehvit:rpv2 anders$ npm install jsdom
npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/jsdom
npm http GET https://registry.npmjs.org/htmlparser
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/cssom
npm http GET https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/htmlparser
npm http 304 https://registry.npmjs.org/contextify
npm http 304 https://registry.npmjs.org/request
Snehvit:Sessions anders$ gradle runJetty8
Dynamic properties are deprecated: http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html
Deprecated dynamic property: "jettyVersion" on "root project 'Sessions'", value: "8.0.2.v20111006".
Deprecated dynamic property: "type" on "DefaultExternalModuleDependency{group='org.eclipse.jetty.orbit', name='javax.servlet', version='3.0.0.v201112011016', configuration='default'}", value: "orbit".
:runJetty8
2012-05-09 22:14:30.822:INFO:omjr.Runner:Runner
2012-05-09 22:14:30.823:WARN:omjr.Runner:No tx manager found
2012-05-09 22:14:30.871:INFO:omjr.Runner:Deploying file:/Users/anders/Projects/SB1/Sessions/build/libs/Sessions.war @ /
[o.e.j.w.WebAppContext{/,null},file:/Users/anders/Projects/SB1/Sessions/build/libs/Sessions.war]
2012-05-09 22:14:30.893:INFO:oejs.Server:jetty-8.0.y.z-SNAPSHOT
@anoras
anoras / altinn.html
Created March 21, 2012 14:11
altinn.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />