Skip to content

Instantly share code, notes, and snippets.

@abstraktor
abstraktor / migrate.st
Created December 9, 2015 12:14
Squeak Vivide migrate Archive
QoppaScriptsArchive class methodsDo: [:method|
|aClass aSelector browser|
aClass := QoppaScriptsArchive class.
aSelector := method selector.
browser := VersionsBrowser new scanVersionsOf: (aClass compiledMethodAt: aSelector) class: aClass meta: aClass isMeta category: (aClass organization categoryOfElement: aSelector) selector: aSelector.
((browser list first beginsWith: 'jr') or: [browser list first beginsWith: 'ck'])
ifTrue: [QoppaScriptsArchive2 class compile: method getSource]]
@abstraktor
abstraktor / gist:eddc74360c517fdf653f
Created April 24, 2015 08:49
use ImageMagick to convert all files in this folder inlace to be small enough
mogrify -define jpeg:extent=300KB *
#!/usr/bin/env ruby
#:set ts=2
class EndedConverter
def endings
[ "\n\r", "\n", "\r" ]
end
# Brew Formula for installing play 12 from abstraktor source
# available on gh gist 6317924
require 'formula'
class Play12Custom < Formula
homepage 'http://www.playframework.org/'
url 'https://github.com/abstraktor/play1', :using => :git, :tag => '1.2.x'
def install
Dir.chdir("framework") do
@abstraktor
abstraktor / timer.js
Created October 24, 2012 20:35
Timer
define([
'underscore',
'backbone'
], function(_, Backbone){
/**
* static variables
**/
var nativeInterval = 10;
@abstraktor
abstraktor / string.rb
Created February 3, 2012 12:35
rotX with ruby
# when you guessed a letter
# rotate("ammi://zbmanu.vhf/tulmktdmhk", "h".ord - "a".ord)
def rotate(str, num)
str.chars.map{|c| (c.ord<97) ? c: ((c.ord+num - 97)%26 + 97).chr}.join("")
end
@abstraktor
abstraktor / create_repo
Created November 25, 2011 16:59
create an hosted git repo without server (dirty!)
#!/usr/bin/env ruby
# this will create a new repo
# to be continued
abort "usage: create-repo <name>\nthe group git-<name> should exist" if ARGV.count != 1
dirname = "%s.git" % ARGV[0]
groupname="git-%s" % ARGV[0]
domain = "timum.de"
@abstraktor
abstraktor / savemsg.js
Created November 21, 2011 01:02
ajax resender for backbone
/*
* This View handles failing backbone requests
* it will display the savestate on #savemsg
* it will resend failed packages after a exponential increasing amount of time
*/
window.View.SaveMsg = Backbone.View.extend({
el: $("#savemsg"),
events: {
"click a.resend": "resend",
@abstraktor
abstraktor / db_sqlseed.rake
Created October 7, 2011 07:37
rake task to dump and load sqlseeds in Rails
namespace :db do
namespace :sqlseed do
desc "drop database and reload seeds"
task :load do
# is this what im looking for?
# FileList['db/seed.sql']
conf = Rails.configuration.database_configuration[Rails.env]
system "mysql -u#{conf['username']} #{conf['database']} <<ENDMYSQL
@abstraktor
abstraktor / gist:1245449
Created September 27, 2011 15:52
adding a loaded flag to Backbone Collections via extension
/*
*= require backbone-rails
*/
(function() {
var _collection = Backbone.Collection;
Backbone.Collection = function() {
// I would like to use Backbone.Events on myself