Skip to content

Instantly share code, notes, and snippets.

View edbond's full-sized avatar
🗽
Working from home

Eduard Bondarenko edbond

🗽
Working from home
View GitHub Profile
-module(shop).
-author('Eduard Bondarenko <edbond@gmail.com>').
-compile(export_all).
main(_) ->
io:format("Welcome to shop you need.").
(defn query-node-with-path
([[ s & _ :as source ]
{type :type children :children wf :word-fragment :as node}
acc]
(prn "source " source)
(prn "s " s)
(prn "type " type)
(prn "node " node)
(prn "acc " acc)))
require 'thread'
class Channel
def initialize
@q = Queue.new
end
def put! val
@q << val
self

Keybase proof

I hereby claim:

  • I am edbond on github.
  • I am edbond (https://keybase.io/edbond) on keybase.
  • I have a public key whose fingerprint is A7FC AAA0 7EC1 E353 E37F 251A 2A5E 9CD4 4F42 923D

To claim this, I am signing this object:

@edbond
edbond / core.cljs
Created June 30, 2014 14:13
marionette contacts editor in om
;; src/contacts/core.cljs
(ns contacts.core
(:require [secretary.core :as secretary
:include-macros true :refer [defroute]]
[goog.events :as events]
[om.core :as om :include-macros true]
[sablono.core :as html :refer-macros [html]]
[alandipert.storage-atom :refer [local-storage]]
[domina :refer [set-styles! by-id value]]
@edbond
edbond / core.clj
Last active August 29, 2015 14:19
md5 bruteforce in Clojure
(ns asajax.core
(:require [clojure.core.async :as async :refer [go chan go-loop <! >!]])
(:import [java.security MessageDigest]
[java.util Arrays])
(:use [criterium.core])
(:gen-class :main true))
;;;;;
(set! *warn-on-reflection* true)
(ns kittens.core
(:require [environ.core :refer (env)]
[clj-http.client :as http]
[clojure.java.io :as io]
[clojure.core.async :as async :refer (go go-loop <!)]))
(def api-key (-> env :dev :flickr :api-key))
(def rest-api-url "https://api.flickr.com/services/rest/")
(def folder "photos")
@edbond
edbond / int_str.clj
Created April 17, 2015 19:13
int to "localized" string in ClojureScript
(def i 343224324234)
(defn int->str-1
[]
(let [s (str i) p (mod (count s) 3)]
(->>
(reduce-kv
(fn [acc i c]
(if (and (> i 0) (zero? (mod (- i p) 3)))
(conj acc \, c)
## application.rb
before_filter :subdomain_settings
def subdomain_settings
subdomains = request.host.split('.')
@is_admin = subdomains.first.match(/^admin-/) ? true : false
@domain = subdomains.first.gsub(/^admin-/,'')
# AV/base.rb
def render(options = {}, local_assigns = {}, &block) #:nodoc:
local_assigns ||= {}
"<!--DBG #{options[:layout]} #{options[:file]} #{options[:partial]} #{options[:text]}-->"+
if options.is_a?(String)
ActiveSupport::Deprecation.warn(
"Calling render with a string will render a partial from Rails 2.3. " +
"Change this call to render(:file => '#{options}', :locals => locals_hash)."
)