Skip to content

Instantly share code, notes, and snippets.

@ideadapt
ideadapt / visualdiff.sh
Last active December 14, 2015 20:49
Visual diff between two name matching sets of images. Supports image magick openmp and parallel execution.
# requirements:
# - imagemagick (optionally with openmp)
# - I used this script to diff screen shots taken with selenium.
# Todo so I recommend you to use https://github.com/swissmanu/protractor-screenshot-reporter and overwrite pathBuilder option.
# e.g. `pathBuilder: () => {return path.join(capabilities.caps_.browserName, descriptions.reverse().join('-').replace(/\s/g, "-").replace(/['":,\/]/g, ""));}`
# usage:
# run tests with setup 1
# rm -rf test/run1 && cp -r test/reports/e2e/screenshots/current/chrome/ test/run1
# run tests with setup 2
@ideadapt
ideadapt / ProgressBar-App.js
Last active August 29, 2015 14:24
angular2 property to attribute binding
// parent & app
import {ComponentAnnotation as Component, ViewAnnotation as View, bootstrap, formDirectives} from 'angular2/angular2';
import {ProgressBar} from 'progress-bar';
@Component({
selector: 'demo-app'
})
@View({
directives: [ProgressBar, formDirectives],
template: `
### Keybase proof
I hereby claim:
* I am ideadapt on github.
* I am bubblez (https://keybase.io/bubblez) on keybase.
* I have a public key whose fingerprint is 9218 4F55 B4EF 94CA 82AA 68DD DC3D 83C8 ED74 DCB6
To claim this, I am signing this object:
@ideadapt
ideadapt / install-osquery-osx
Last active August 29, 2015 14:08
Install Facebook OSQuery on OSX Mavericks
# prerequisites: python, git, brew, cmake
git clone --resursive https://github.com/facebook/osquery.git
cd osquery
sudo easy_install pip
brew install doxygen
make deps
make
chmod -R o+w build/darwin // if make fails with permission error
sudo make install
Index: lib/rails_admin/adapters/active_record.rb
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>require 'active_record'\nrequire 'rails_admin/adapters/active_record/abstract_object'\n\nmodule RailsAdmin\n module Adapters\n module ActiveRecord\n DISABLED_COLUMN_TYPES = [:tsvector, :blob, :binary, :spatial, :hstore, :geometry]\n DISABLED_COLUMN_MATCHERS = [/_array$/]\n\n def new(params = {})\n AbstractObject.new(model.new(params))\n end\n\n def get(id)\n if object = model.where(primary_key => id).first\n AbstractObject.new object\n end\n end\n\n def scoped\n model.all\n end\n\n def first(options = {}, scope = nil)\n all(options, scope).first\n end\n\n def all(options = {}, scope = nil)\n scope ||= self.scoped\n scope = scope.includes(options[:include]) if options[:include]\n
@ideadapt
ideadapt / gist:5845347
Last active December 18, 2015 21:09
coffeescript class, instance (variables/methods) and this context issues.
class Animal
@classVar = 'class var'
constructor: (@options) ->
@memberVar = 'the member'
_privateMethod: (param) ->
console.log('private instance method ' + param)
instanceMethod: ->
@ideadapt
ideadapt / capistrano deploy:update_code git error
Last active December 18, 2015 14:18
capistrano deploy:update_code git error
# sometims capistranos fails executing update_code goal:
* 2013-06-17 08:08:34 executing `deploy:update_code'
executing locally: "git ls-remote . HEAD"
command finished in 9ms
* refreshing local cache to revision f4db at /var/folders/nc/pl0c_dnd43bb6xl5ljdfh5zh0012gn/T/proj
executing locally: cd /var/folders/nc/pl0c_dnd43bb6xl5ljdfh5zh0012gn/T/proj && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard f4db8ab10f23ddd2864ebfeee7486bdf3bd8e423 && git clean -q -d -x -f
fatal: Not a git repository (or any of the parent directories): .git
# to reset your local cache folder execute following commands:
rm -rf /var/folders/*
set theStartingValue to "6710" -- this is the year to get data for
set theEndingValue to "7777" -- this is now the beginning date
set outputFolder to POSIX path of (choose folder) -- the folder to save the output files to
repeat with theIncrementValue from theStartingValue to theEndingValue by 1
set theURL to "http://polentajam.ch/Bildergallerie/galleries/PJam10-2012/IMG_" & theIncrementValue & ".jpg"
@ideadapt
ideadapt / config.yml
Created January 17, 2012 14:52
customize sonataadminbundle using the config.yml
sonata_admin:
templates:
layout: SonataAdminBundle::my_standard_layout.html.twig
@ideadapt
ideadapt / formmapper_snippet.php
Created January 17, 2012 14:50
add tinymce to form field in symfony2
$formMapper
->with('General')
->add('title')
->add('blog', 'textarea', array('attr' => array('class' => 'tinymce', 'tinymce'=>'{"theme":"simple"}')))