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 / environment.rb
Created July 8, 2011 10:11 — forked from joshuap/environment.rb
Net:HTTP enabled URI Validator for Rails 3
...
require 'uri_validator'
@Krule
Krule / jQuery.thatHasNo.coffee
Created December 30, 2011 14:19
That Has No
jQuery.fn.thatHasNo = (element, method = "children") ->
@.not ->
$(@)[method](element).length
@Krule
Krule / labels.tex
Created December 3, 2012 15:54
When I need a lots of same label
\documentclass[a4paper]{article}
\usepackage[newdimens]{labels}
\usepackage[utf8]{inputenc}
\LabelCols=4
\LabelRows=10
\LabelGridtrue
\numberoflabels=40
\LabelInfotrue
<!-- ~/Library/Application Support/Sublime Text 3/Packages/User/Ruby/pry.sublime-snippet -->
<snippet>
<content><![CDATA[require 'pry'; binding.pry]]></content>
<tabTrigger>pry</tabTrigger>
<scope>source.ruby</scope>
<description>binding.pry</description>
</snippet>
@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