Skip to content

Instantly share code, notes, and snippets.

View nthx's full-sized avatar

Tomasz Nazar nthx

View GitHub Profile
@nthx
nthx / .profile
Last active August 29, 2015 14:17
#.....
# configuration below *cannot* be inside .bashrc
. ~/public/github/dotfiles/bashrc.my.bash_zsh_support
#.....
@nthx
nthx / gist:3856135
Created October 9, 2012 01:57
Example of frontend persistence
class SeenTutorialPersistence
constructor: (@usecase, @serverSide) ->
execute: =>
After(@usecase, 'readyToStart',
=> @serverSide.storePlayerIsReadyToStart())
@nthx
nthx / gist:3856121
Created October 9, 2012 01:53
Example of a view
class WebGui
initialize: =>
@mainScreen = new Screen('template-game-main')
showWelcome: =>
@mainScreen.show()
@mainScreen.find('.game-start-button').click @startBtnClicked
startBtnClicked: =>
@nthx
nthx / gist:3856082
Created October 9, 2012 01:42
Example of a glue
class WebGlue
constructor: (@usecase, @gui, @soundAPI)->
@memory = @usecase.memoryGame
applyMemoryGameGlue: =>
Before(@usecase, 'startMemoryGame',
=> @gui.showWelcome(@memory.timeLimit))
After(@memory, 'readyToStart', @gui.showStart)
After(@memory, 'teachHowToPlay', @gui.showTutorial)
@nthx
nthx / gist:3856062
Created October 9, 2012 01:37
Example of a usecase empty aop fns
...
readyToStart: => #empty. aop here..
teachHowToPlay: => #empty. aop here..
...
@nthx
nthx / gist:3856049
Created October 9, 2012 01:34
Example of a usecase entry point
playerFinishedTutorial: =>
@playerCompletedTutorial = true
@readyToStart()
@nthx
nthx / gist:3856019
Created October 9, 2012 01:24
Example of a usecase + model (pure domain)
class MemoryGameUseCase
constructor: ->
@games = []
@timeLimit = 60
playerRequestsStart: =>
if @knowsHowToPlay()
@start()
else
@teachHowToPlay()
@nthx
nthx / TamperMonkeyScriptWithJqueryAndSugar.js
Created September 3, 2012 01:36
Hello World TamperMonkey script with jquery/sugarjs
// ==UserScript==
// @match https://yourwebsite.com/xyz
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @require http://cdnjs.cloudflare.com/ajax/libs/sugar/1.3/sugar.min.js
// ==/UserScript==
alert('Hello, I got jQuery included and sugarJs too');
var runEverySecond = function(){
$('p').find('img').attr('width', '0px');
@nthx
nthx / production-env-for-compressing-js-into-readable.rb
Created July 12, 2012 12:25
Production env for compressing Javascript, but still making it readabale
config.assets.compress = true
require 'uglifier'
config.assets.js_compressor = Uglifier.new(
{:beautify=>true,
:beautify_options =>
{:indent_level => 2,
:indent_start => 0,
:space_colon => false}
})
@nthx
nthx / gist:2714932
Created May 16, 2012 23:40 — forked from hashmal/gist:803816
Blogged on aspectized.com..
# I blogged about our usage of "Swappable Mixins in CoffeeScript". Thanks!
#
# http://aspectized.com/2012/05/mixins-in-coffeescript/
#
# we used Underscore to help with `this` binding. This way role&base class can
# modify their data
#
# .....