Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require "chunky_png"
#require "oily_png"
def screenshot(display = ":0")
mine_pipe, xwd_pipe = IO.pipe
png = nil
begin
@inossidabile
inossidabile / Effects.coffee
Created May 30, 2012 11:06
Joosy / Load, unload and 'in-progress' animations
# pages/application.js.coffee
class @ApplicationPage extends Joosy.Page
@beforePaint (container, complete) ->
#@layout.showSystemPreloader() if !@dataFetched
complete()
@paint (container, complete) ->
#@layout.hideSystemPreloader()
container.fadeTo 80, 0, =>
@inossidabile
inossidabile / Bootstrap.coffee
Created May 29, 2012 19:47
Joosy / Preloaders
bootstrap = ->
$('#preloader').remove()
Joosy.Application.initialize 'blog','#application',
environment: window.joosy.environment
debug: false
@inossidabile
inossidabile / Form.haml
Created May 29, 2012 18:11
Joosy / Helpers
!= @formFor resource, {class: 'foo'}, (f) ->
!= f.label 'field', {class: 'foo'}, 'inner text'
!= f.radioButton 'field', 'value', {class: 'foo'}
!= f.textArea 'field', {class: 'foo'}
!= f.checkBox 'field', {class: 'foo'}
!= f.textField 'field', {class: 'foo'}
!= f.fileField 'field', {class: 'foo'}
!= f.hiddenField 'field', {class: 'foo'}
!= f.passwordField 'field', {class: 'foo'}
@inossidabile
inossidabile / Editor.coffee
Created May 29, 2012 11:14
Joosy / Dynamic Rendering
elements:
'titlePane': 'h1'
'titleForm': 'form'
events:
'click $titlePane': (element) ->
@titlePane.hide()
@titleForm.show()
@afterLoad ->
Joosy.Form.attach $('element'),
success: (data) ->
error: (data) ->
progress: (data) ->
action: 'URL'
@inossidabile
inossidabile / Events (complex).coffee
Created May 28, 2012 15:25
Joosy / Blog / Elements, Events and Filters
# layouts/application.js.coffee
class @ApplicationLayout extends Joosy.Layout
@view 'application'
elements:
'navigationBar': '.navbar'
'clocks': '.navbar .pull-right a'
events:
'mouseenter $navigationBar': 'showClocks'
@inossidabile
inossidabile / Fetch.coffee
Created May 25, 2012 04:33
Joosy / Blog / Layouts, Pages and Routing
# pages/posts/index.js.coffee
Joosy.namespace 'Posts', ->
class @IndexPage extends ApplicationPage
@layout ApplicationLayout
@view 'index'
@fetch (complete) ->
Post.find 'all', (posts) =>
@data.posts = posts
@inossidabile
inossidabile / Basic entry actions.coffee
Created May 23, 2012 13:17
Joosy / Blog / Resource
Post.find 2, (post) -> # Loads entity from /posts/2
post('title') # Returns 'Test post'
post('title', 'New and better title!') # Sets new title value
post('title') # Returns 'New and better title!'
post.reload -> # Reloads fields from server
post('title') # Returns 'Test post'
post.delete -> console.log 'Deleted!' # Deletes fetched entity (DELETE /posts/2)
@inossidabile
inossidabile / Bundle.sh
Last active October 5, 2015 05:48
Joosy / Blog / Rails preparations
bundle install