Skip to content

Instantly share code, notes, and snippets.

Avatar

Theo Cushion theozaurus

  • Ignition Works
  • UK
View GitHub Profile
@theozaurus
theozaurus / 2774_example.html
Created May 21, 2019
Support for apps loaded from Windows file shares
View 2774_example.html
<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>
View lazy_stream.rb
class A
def initialize(*processors)
@processors = processors
end
def call(list)
@processors.inject(0) { |acc, p|
acc + p.call(list)
}
end
end
View gist:0fce4c06dd1087756aad
2015-04-28T16:29:06.000+00:00 [API] OUT Updated app with guid 10e57b46-bc2d-4255-8df1-7fab3ca24c34 ({"state"=>"STOPPED"})
2015-04-28T16:29:16.000+00:00 [STG] OUT -----> Installing dependencies using 1.7.12
2015-04-28T16:29:23.000+00:00 [STG] OUT Using thread_safe 0.3.5
2015-04-28T16:29:23.000+00:00 [STG] OUT Using tilt 1.4.1
2015-04-28T16:29:23.000+00:00 [STG] OUT Using rails_serve_static_assets 0.0.4
2015-04-28T16:29:23.000+00:00 [STG] OUT Using rails_stdout_logging 0.0.3
2015-04-28T16:29:23.000+00:00 [STG] OUT Using nokogiri 1.6.6.2
2015-04-28T16:29:23.000+00:00 [STG] OUT Using rails_12factor 0.0.3
2015-04-28T16:29:23.000+00:00 [STG] OUT Using activesupport 4.2.1
2015-04-28T16:29:23.000+00:00 [STG] OUT Using html2haml 2.0.0
View find_unused_helpers.rb
#!/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 )
View gist:5544339
var manipulation = (new toHTML()).then(
new Manipulate.HTML.shortenLinks()
).then(
new Manipulate.HTML.toStr()
).end();
Get Text Nodes
Find important Words
View gist:3003499
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 Feb 15, 2012
In Chef 0.9.14 the app.user used to get set to "foo". However this no longer happens, even with the `expand` command.
View Attributes file
expand! # This used to solve the problem chef ~0.9.14
default[:app][:name] = "website"
default[:app][:user] = app[:name]
View www.skyrimnexus.com
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
View Javascript
// Models
HTH.Project = SC.Record.extend({
title: SC.Record.attr(String),
tasks: SC.Record.toMany('HTH.Task',{
isMaster: YES,
inverse: 'project'
})
});
View Demo
// 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);