Skip to content

Instantly share code, notes, and snippets.

View devmanhinton's full-sized avatar

Devon Hinton devmanhinton

  • dv01
  • New York City
View GitHub Profile
7:29:15 BUILDER: devon, staging, brief:oct3_integration: restarting first service
COMMAND: sudo su deploy sg apps -c 'cd -P /mnt/services/brief/current && TORQUEBOX_HOME=/mnt/torquebox/current JBOSS_HOME=/mnt/torquebox/current/jboss JRUBY_HOME=/usr/bin/jruby /usr/bin/jruby/bin/jruby -S torquebox deploy --name=brief-service .'
status: 1; err: ; out: Errno::EACCES: Permission denied - Permission denied
utime at org/jruby/RubyFile.java:1040
touch at /usr/local/share/jruby-1.7.2/lib/ruby/1.9/fileutils.rb:1146
each at org/jruby/RubyArray.java:1613
touch at /usr/local/share/jruby-1.7.2/lib/ruby/1.9/fileutils.rb:1143
deploy_yaml at /usr/local/share/jruby-1.7.2/lib/ruby/gems/shared/gems/torquebox-rake-support-2.3.0/lib/torquebox/deploy_utils.rb:317
deploy at /usr/local/share/jruby-1.7.2/lib/ruby/gems/shared/gems/torquebox-2.3.0/bin/torquebox:112
__send__ at org/jruby/RubyBasicObject.java:1665
@devmanhinton
devmanhinton / gist:6875413
Created October 7, 2013 21:40
Fun times with combining javascript files
1 #!/bin/bash
2 pushd ~/Amicus/suspendors_project/suspendersTest/client_side_js
3 if [ -e "bundle.js" ]
4 then
5 echo "removing old bundle.js"
6 rm -f bundle.js
7 fi
8 if [ -e "main.js" ]
9 then
10 echo "removing old bundle.js"
@devmanhinton
devmanhinton / gist:7013095
Last active December 25, 2015 17:29
Combing many files to one end_dash_templates.js
var fs = require('fs')
, path = require('path')
, _ = require('underscore')
, outputPath = __dirname
, filesToParse = 0
, callback
var compressFiles = function(templatesLocation, outputPath, callback) {
if (arguments.length != 3) {
throw new Error("All three arugments are required")
@devmanhinton
devmanhinton / gist:7103303
Created October 22, 2013 16:00
Way to include views
Add EndDash.View.extend
== Client can call EndDash.view.extend({
.... Normal Backbone View things ....
})
Under the hood will return "Backbone.View.extend({
.... Same Normal Backbone View things ....
})
@devmanhinton
devmanhinton / gist:7197605
Last active December 26, 2015 18:49
Alternative to Current Collection Recognition
Hey!
Currently, a collection is recognized by the rules.js "collection" rule-- The el has a child that is the singular version
of itself.
This adds a cognitive load because it adds a conidtional to another rule:the model/scoping rule.
The model/scoping rule without collections: 'A dom elem with a class that ends in a dash will bind the children
of that dom element to the child of that name of the current model in scope'
bucket = Storage.fetch.buckets["postcard_batch"]
Dir.mkdir('photos/')
bucket.objects.each do |obj|
File.open("photos/#{obj.key}", 'wb') do |file|
obj.read do |chunk|
file.write(chunk)
end
end
end
bucket = Storage.fetch.buckets["postcard_batch"]
Dir.mkdir('photos/')
bucket.objects.each do |obj|
File.open("photos/#{obj.key}.png", 'wb') do |file|
obj.read do |chunk|
file.write(chunk)
end
end
end
#decode base64
Dir.mkdir('decoded_photos/')
Dir.foreach('./photos') do |item|
next if !item.match(/.*_signature_image/)
base64_encoded = File.read("photos/" + item)
decocded = Base64.decode64(base64_encoded.split(',')[1])
File.open("decoded_photos/#{item}.png", 'wb') do |file|
file.write(decocded)
end
end
@devmanhinton
devmanhinton / gist:b360be3595e8f3599074
Created April 30, 2015 21:22
Auto Start ClassPath virtualenv
This is for zsh so you might have to change for other shells but general idea is the same
Note: Change 'ClassPath' to the root of your project
chpwd () {
case $PWD in
*ClassPath*)
python -c 'import sys; print sys.real_prefix' 2>/dev/null 1>/dev/null || source bin/activate
esac
}