Skip to content

Instantly share code, notes, and snippets.

@dgm
dgm / gist:597180
Created September 25, 2010 19:25
Funny form submit behaviour
<html>
<head>
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">
// handle some keypresses to navigate in a grid style
$('.tabstop').live('keydown',function(e){
switch(e.which) {
case 40: // down
e.preventDefault();
$(this).nextAll().filter('.tabstop').first().focus();
$('.list-delete').live("ajax:success", function(xhr, data, status) {
$(this).closest('li').html(data).effect("highlight", {}, 2000).fadeOut();
});
class Chef::Recipe::WestedRepo
attr_reader :project
def initialize(project)
@project = project
end
def create_user
user project[:id] do
action :create
%w(this that).each do |pkg|
yum_package pkg do
action :install
end
end
%(this that).each {|pkg| package pkg}
1.9.3-p327 :001 > "foo
1.9.3-p327 :002"> bar
1.9.3-p327 :003"> baz"
=> "foo\nbar\nbaz"
1.9.3-p327 :004 > foo = <<EOL
1.9.3-p327 :005"> foo
1.9.3-p327 :006"> bar
1.9.3-p327 :007"> baz
1.9.3-p327 :008"> EOL
=> "foo\nbar\nbaz\n"
@dgm
dgm / gist:9994949
Created April 5, 2014 17:23
Some good tips on pdf generation in rails
http://www.sitepoint.com/pdf-generation-rails/
http://adamalbrecht.com/2014/01/14/generate-clean-testable-pdf-reports-in-rails-with-prawn/
http://big-elephants.com/2012-12/pdf-rendering-with-phantomjs/
@dgm
dgm / gist:dc2876a136da1b3759ff11fc6c75974e
Created May 12, 2016 01:01
Latest crashplan update complete borked on synology
TARGETDIR=/volume1/@appstore/CrashPlan
BINSDIR=/bin
MANIFESTDIR=/volume1/crashplan/backupArchives
INSTALLDATE=20160428
JAVACOMMON=${JAVA_HOME}/bin/java
APP_BASENAME=CrashPlan
DIR_BASENAME=crashplan
JRE_X64_DOWNLOAD_URL=http://download.code42.com/installs/proserver/jre/jre-7-linux-x64.tgz
JRE_I586_DOWNLOAD_URL=http://download.code42.com/installs/proserver/jre/jre-7-linux-i586.tgz
Sourcing ../../install.vars...
- name: get app source
aws_s3:
aws_access_key: "{{ lookup('ini', 'aws_access_key_id section=default file=~/.aws/credentials') }}"
aws_secret_key: "{{ lookup('ini', 'aws_secret_access_key section=default file=~/.aws/credentials') }}"
bucket: my_bucket
object: /files/my_app.tar.gz
dest: /home/app/my_app.tar.gz
mode: get
environment:
S3_USE_SIGV4: True