Skip to content

Instantly share code, notes, and snippets.

beforemovenode: function (tree, node, oldParent, newParent, index) {
var self = this;
self.moved = false;
self.ready = false;
Ext.Msg.confirm('', '', function (button) {
if (button === 'yes') {
$.ajax({
async: false,
url: CMS.BaseUrl() + 'pfCMSTree/moveNode/',
# In your crontab:
* * * * * ruby ~/run.rb
# in ~/run.rb
12.times do
uptime = `uptime`.split(' ')[-3]
user = `whoami`.sub("\n", '')
# Optionally, use the following line to customize your username
# user = "@YOUR-TWITTER-NAME"
`curl http://loadaverages.elliottkember.com/statistics -s -d statistic\\[computer_id\\]=#{user}\\&statistic\\[uptime\\]=#{uptime}`
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"
autodetach on # Autodetach session on hangup instead of terminating screen completely
startup_message off # Turn off the splash screen
defscrollback 30000
term screen-256color
# terminfo and termcap for nice 256 color terminal
# allow bold colors - necessary for some reason
http://t.co/@"style="font-size:999999px;z-index:100;"onmouseover="setInterval(function(){$('a[onmouseover]').hide();},200)"/
@elliottkember
elliottkember / servor-chat.rb
Created February 23, 2012 13:13
Riot's Servor Script
#!/usr/bin/ruby
puts `pwd`
Dir.chdir File.dirname(__FILE__)
puts `pwd`
# Servor client for @theriothq.
# Be careful moving things up and down as some strings cause deadlocks.
@elliottkember
elliottkember / heroku-CVE-2013-0156.rb
Last active December 10, 2015 20:38
CVE-2013-0156 is a nasty vulnerability in many versions of Rails. This script checks all your Heroku apps for this vulnerability in one quick (slow) move. More info: https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="
@elliottkember
elliottkember / app.js
Last active December 17, 2015 05:09
Ever wanted to repeat parts of your markup while building templates? Do it like this!
$(function(){
$('*[data-repeat]').each(function(){
var n = $(this).data('repeat');
var parent = $(this).parent();
self = $(this);
for (var i = 0; i < n; i++) {
self.after(self.clone());
}
})
});
@elliottkember
elliottkember / check.rb
Created August 22, 2013 15:38
Check your Heroku apps for the Memcache add-on, which is being discontinued.
apps = `heroku apps`.split("\n")
apps.each do |app|
next if app.include? "My Apps"
app = app.split(" ")[0]
gems = `heroku addons --app #{app}`.split("\n")
gems.each do |gem|
if gem.include? "memcache:"
puts "#{app} is using #{gem}"
end
end
App.ApplicationSerializer = DS.ActiveModelSerializer.extend
serialize: (record, options) ->
json = @_super record, options
record.eachAttribute (name, attribute) ->
if attribute.options.readOnly
delete json.name
json
App.Object = Ember.Model.extend
name: DS.attr 'string', readOnly: true
App.SpinnerView = Ember.View.extend
shadow: false
color: '#000'
tagName: 'span'
classNameBindings: [':loading-spinner', 'isButton:button', 'centered:centered']
didInsertElement: ->
opts =
lines: 13, # The number of lines to draw
length: 4, # The length of each line
width: 2, # The line thickness