Skip to content

Instantly share code, notes, and snippets.

View Szeliga's full-sized avatar

Szymon Szeliga Szeliga

View GitHub Profile
class DatePickerInput < SimpleForm::Inputs::StringInput
def display_pattern
I18n.t('datepicker.dformat', default: '%d/%m/%Y')
end
def picker_pattern
I18n.t('datepicker.pformat', default: 'dd/MM/yyyy')
end
def wrapper_classes
@Szeliga
Szeliga / gist:3d4ce2925c89a7fbcc59
Created February 25, 2015 12:24
Webpack config
var webpack = require('webpack');
var path = require('path');
var node_modules_dir = __dirname + '/node_modules';
var node_env = process.env.NODE_ENV;
var config = {
addVendor: function(name, path) {
this.resolve.alias[name] = path;
},
addPlugin: function(plugin) {
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

Debugging & Profiling Node.js

This is a maintained listing of all the different ways to debug and profile Node.js applications. If there is something missing or an improvement, post a comment! :)

Interactive Stack Traces with traceGL - Shareware

  1. Guide here
# SVG path string
path_string = "M,208,405C,208,405,206,744,206,744C,206,744,552,715,552,715C,552,715,590,451,590,451C,590,451,208,405,208,405"
# points will contain an array of arrays for each point of the path
points = Raphael.parsePathString(pe.attrs.path_string)
spline = new THREE.Shape()
spline.autoClose = true
_.each points, (p, i) ->
switch p[0]
@Szeliga
Szeliga / .gitignore
Created October 21, 2012 16:56 — forked from bergie/.gitignore
Node.js email handling examples
config.json
reading-image.png
def touch
@user.touch
render :json => {"status" => "touched"}
end
def index
if stale?(:last_modified => @clients.maximum("updated_at"), :etag => @clients)
respond_with @clients.as_json(:methods => [:emails_count, :phones_count, :communications_count])
end
end
def show
if stale?(@client)
respond_with @client.to_json(:include => {
:emails => {:limit => 10},
clients = Client.limit(10)
clients.each do |client|
puts client.address.postcode
end