Skip to content

Instantly share code, notes, and snippets.

@gtyanchev
gtyanchev / _simple_partial.html.erb
Last active December 12, 2017 09:57
Partial with yield
<div>
yeeee I'm rendered
<p>
<%= yield :paragraph %>
</p>
<strong>
<%= yield :bold_text %>
</strong>
<style type="text/css">
/* Star hover using lang hack in its own style wrapper, otherwise Gmail will strip it out */
* [lang~="star-wrapper"]:hover *[lang~="star-number"]{
color: #119da2 !important;
border-color: #119da2 !important;
}
* [lang~="star-wrapper"]:hover *[lang~="full-star"],
* [lang~="star-wrapper"]:hover ~ *[lang~="star-wrapper"] *[lang~="full-star"] {
@gtyanchev
gtyanchev / gist:a5dfc337fa72c5cca587
Created January 21, 2015 10:59
pyramid_of_doom_destroyed
Users.login(username, password)
.then(function () {
return usersModel.load();
})
.then(function () {
mobileApp.navigate('views/notesView.html');
})
.then(function() {
alert("You've logged in!");
})
@gtyanchev
gtyanchev / gist:f3f6a382399f9af91bb4
Last active August 29, 2015 14:13
pyramid_of_doom.js
Users.login(
username,
password,
function () {
usersModel.load(
function () {
App.navigate('profile.html',
function () {
alert("You've logged in!");
},
(ns histogram.core
(:gen-class)
(require [clojure.java.io :refer [file output-stream input-stream]]
[clojure.pprint :as pprint]
[clojure.data.priority-map :as pm])
(:import (java.util.concurrent Executors)
(java.util.BitSet)))
(defprotocol HuffmanTree
(leaf? [tree])
@gtyanchev
gtyanchev / histogram.clj
Last active August 29, 2015 14:02
Histogram
(ns histogram.core
(:gen-class)
(require [criterium.core :as criterium]
[clojure.pprint :as pprint]))
(defn do-sort-map [x]
(into
(sorted-map-by
(fn [key1 key2]
(compare [(get x key2) key2]