Skip to content

Instantly share code, notes, and snippets.

View Krule's full-sized avatar
🍐
Fruity

Armin Pašalić Krule

🍐
Fruity
View GitHub Profile
@Krule
Krule / template.rb
Last active August 29, 2015 14:01
Basic rails template
generate(:controller, "app index")
route "root to: 'app#index'"
git :init
git add: "."
git commit: %Q{ -m 'Initial commit' }
# Gems
gem 'rails'
gem ''
@Krule
Krule / introrx.md
Last active August 29, 2015 14:07 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@Krule
Krule / base.rb
Last active August 29, 2015 14:08
Base template
# Base template
# Empty gemfile
run 'cat /dev/null > Gemfile'
# Build new one
add_source 'https://rubygems.org'
gem 'bcrypt', '~> 3.1.7'
gem 'coffee-rails', '~> 4.0.0'
$fontawesome_path: "." !default
@font-face
font-family: 'FontAwesome'
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot')
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot?#iefix') format("embedded-opentype"), font-url('#{$fontawesome_path}/fontawesome-webfont.woff') format("woff"), font-url('#{$fontawesome_path}/fontawesome-webfont.ttf') format("truetype")
font-weight: normal
font-style: normal
@mixin icon($icon)

Keybase proof

I hereby claim:

  • I am krule on github.
  • I am krule (https://keybase.io/krule) on keybase.
  • I have a public key whose fingerprint is FBD5 ECFC 66E7 9973 7834 0828 83F1 2B32 0729 DFB8

To claim this, I am signing this object:

@Krule
Krule / mysql_stored_functions.rb
Last active August 29, 2015 14:19
Stored functions for string escaping for CSV export
module MysqlStoredFunctions
def store_urlencode_function
sql = <<-_SQL
DROP FUNCTION IF EXISTS urlencode;
^
-- Thank Jeremy Thomerson for this one
-- http://jeremythomerson.com/2013/05/30/urlencoder-function-for-mysql/
CREATE FUNCTION URLENCODE(str VARCHAR(4096) CHARSET utf8) RETURNS VARCHAR(4096) CHARSET utf8
DETERMINISTIC
CONTAINS SQL
@Krule
Krule / articles_controller.rb
Created July 16, 2010 13:13
Pluralize using Rails 3 in Slovenian language
class ApartmentsController < ApplicationController
def index
@apartments = Apartment.all
end
end
@Krule
Krule / radio-sarajevo.html
Created September 26, 2010 02:26
HTML5 Radio Sarajevo
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Radio</title>
</head>
<body>
<audio src="http://malla.softnet.si:8000/" controls preload> </audio>
</body>
</html>
// Based on http://snipt.net/boriscy/datetime-jquery-formtastic/
$.tools.dateinput.localize("ja", {
months: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月',
shortMonths: '1月,2月,3月,4月,5月,6月,7月,8月,9月,10月,11月,12月',
days: '日曜日,月曜日,火曜日,水曜日,木曜日,金曜日,土曜日',
shortDays: '日,月,火,水,木,金,土'
});
$.tools.dateinput.conf.format = 'yyyy-mm-dd';
@Krule
Krule / application.js
Created January 20, 2011 15:05
Example for Marko
/*
=form_for :sendemail, :url => :sendemail_index,:remote => true, :html => { :"data-name" => "Contact ASC Admin", :"data-cancelable" => true }
*/
var Asc = {
center: $(window).width() / 2,
_init: function(){
Asc.notice_fade()