Skip to content

Instantly share code, notes, and snippets.

View theozaurus's full-sized avatar

Theo Cushion theozaurus

  • Black Tree Gaming
  • UK
View GitHub Profile
@theozaurus
theozaurus / gist:716974
Created November 26, 2010 17:17
foobar.conf
# Enable upload_progress module for easy cross browser progress bar support
# using only javascript client side
upload_progress foobar_uploads 1m;
server {
# We only need one server block to deal with HTTP and HTTPS
# avoids duplication
listen 80;
listen 443 default ssl;
@theozaurus
theozaurus / 2774_example.html
Created May 21, 2019 15:29
Support for apps loaded from Windows file shares
<html>
<head>
<title>Reproduction for Issue 2774</title>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-router@3.0.6/dist/vue-router.min.js"></script>
</head>
<body>
<h1><a href="https://github.com/vuejs/vue-router/pull/2774">Reproduction for Issue 2774</a></h1>
<h2>Instructions</h2>
@theozaurus
theozaurus / lazy_stream.rb
Last active June 3, 2016 11:06
Lazy streams
class A
def initialize(*processors)
@processors = processors
end
def call(list)
@processors.inject(0) { |acc, p|
acc + p.call(list)
}
end
end
#!/usr/bin/env ruby
#
# Shotgun approach (read: slow and dirty hack) to help find unused helpers in a Rails application
#
puts "Loading all source files into memory :("
source = {}
Dir["app/**/**/*.*"].each do |f|
source[ f ] = File.readlines( f )
var manipulation = (new toHTML()).then(
new Manipulate.HTML.shortenLinks()
).then(
new Manipulate.HTML.toStr()
).end();
Get Text Nodes
Find important Words
2012-06-27 11:30:32.844405 [CONSOLE] mod_commands.c:559 Timer Test: 1 sleep 10 10000
2012-06-27 11:30:32.854404 [CONSOLE] mod_commands.c:559 Timer Test: 2 sleep 10 9998
2012-06-27 11:30:32.864404 [CONSOLE] mod_commands.c:559 Timer Test: 3 sleep 10 9999
2012-06-27 11:30:32.874401 [CONSOLE] mod_commands.c:559 Timer Test: 4 sleep 10 9998
2012-06-27 11:30:32.884404 [CONSOLE] mod_commands.c:559 Timer Test: 5 sleep 10 10003
2012-06-27 11:30:32.894402 [CONSOLE] mod_commands.c:559 Timer Test: 6 sleep 10 9998
2012-06-27 11:30:32.904402 [CONSOLE] mod_commands.c:559 Timer Test: 7 sleep 10 10000
2012-06-27 11:30:32.914404 [CONSOLE] mod_commands.c:559 Timer Test: 8 sleep 10 10002
2012-06-27 11:30:32.924403 [CONSOLE] mod_commands.c:559 Timer Test: 9 sleep 10 9998
@theozaurus
theozaurus / Attributes file
Created February 15, 2012 11:18
In Chef 0.9.14 the app.user used to get set to "foo". However this no longer happens, even with the `expand` command.
expand! # This used to solve the problem chef ~0.9.14
default[:app][:name] = "website"
default[:app][:user] = app[:name]
ubuntu@staging:~$ ab -n 1500 -c 150 http://www.skyrimnexus.com/index.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.skyrimnexus.com (be patient)
apr_socket_recv: Connection timed out (110)
Total of 143 requests completed
// Models
HTH.Project = SC.Record.extend({
title: SC.Record.attr(String),
tasks: SC.Record.toMany('HTH.Task',{
isMaster: YES,
inverse: 'project'
})
});
// Successful updating of a task
HTH.store.find(HTH.Project).get('firstObject').set('title','Updated the title!');
// Unsuccessful attempt to add a task to a project
var project = HTH.store.createRecord(HTH.Project, {title: "New" });
var task = HTH.store.createRecord(HTH.Task, {title: "New task" });
task.set('project',project);
project.get('tasks').pushObject(task);