Skip to content

Instantly share code, notes, and snippets.

View schovi's full-sized avatar
👁️

David Schovanec schovi

👁️
View GitHub Profile
-lpthread -lcrypt -lm /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.9/ext/nginx/../common/libpassenger_common.a /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.9/ext/nginx/../common/libboost_oxt.a -lstdc++ -lpthread /tmp/root-passenger-8277/pcre-8.12/.libs/libpcre.a -lssl -lcrypto -ldl -lz
/usr/bin/ld: /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.9/ext/nginx/../common/libpassenger_common.a(aggregate.o): undefined reference to symbol 'round@@GLIBC_2.2.5'
/usr/bin/ld: note: 'round@@GLIBC_2.2.5' is defined in DSO /usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libm.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/../../../x86_64-linux-gnu/libm.so: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory `/home/schovi/tmp/nginx'
make: *** [build] Error 2
--------------------------------------------
@schovi
schovi / Test.hs
Created July 26, 2012 19:08
How to use 'read' in haskell
processDbRequest :: Connection -> [String] -> String
processDbRequest conn record@(tableId:requestType:_:rawParams) =
let params = extractParams rawParams
tableId = read tableId
recordId = read (params M.! 1)
in case tableId of
1 -> "yes"
_ -> "oh no"
@schovi
schovi / GHCI
Created July 30, 2012 14:28
Test of converting UTCTime to sql
schovi@Connie~/tmp/haskell$ ghci
GHCi, version 7.4.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :l time
[1 of 1] Compiling Main ( time.hs, interpreted )
Ok, modules loaded: Main.
*Main> date
Loading package array-0.4.0.0 ... linking ... done.
data Record = Record { subject :: Subject
, logo :: Maybe Logo
, address :: Maybe Address
, branchRecords :: [BranchRecord]
, subscriptions :: [Subscription]
, comments :: [Comment]
, categories :: [String]
, keywords :: [String]
} deriving (Show, Eq)
@schovi
schovi / curl.example
Created September 14, 2012 17:58
How to use httpie instal of curl with elasticsearch
$ curl -XPUT 'http://localhost:9200/twitter/' -d '{
index : {
number_of_shards : 3
number_of_replicas : 2
}
}'
@schovi
schovi / plugin.helper.can.js
Created September 24, 2012 19:32
CanJS helper that allows ejs construction like this <div <%= plugin("plugin_name") %> clas="smt">
can.EJS.Helpers.prototype.plugin = function(plugin, params) {
return function(el) {
if(typeof plugin == "string") {
$(el)[plugin](params);
} else {
new plugin(el, params)
}
}
}
@schovi
schovi / can-notify.md
Created December 6, 2012 08:36 — forked from amcdnl/can-notify.md
CanJS Notification System

CanJS Notification System

This widget creates a growl-like notification on a website using CanJS framework.

JavaScript

steal('can/construct',
	  'can/construct/super',
	  'can/construct/proxy',

'can/control',

@schovi
schovi / article.ejs
Last active December 10, 2015 02:18
CanJS simple control example
<div <%= (el) -> can.data(el,'article',this) %> class="hidden article article-<%= this.id %>" <%= (el) -> el.fadeIn()%> >
<%= this.name %>
</div>
@schovi
schovi / example.js
Last active December 11, 2015 01:39
Helper for not so common case, where your nested object is flatten into lot of key -> val. In each pair key is created by join all keys in chain with dot. {'index.type':1} is {index: {type: 1}} and so. Works with arrays too. {'array.0':"a",'array.1':"b"} became {array:["a","b"]}. This is used in some parts of elasticsearch json http api.
// jsFiddle example
// http://jsfiddle.net/k7Fgt/1/
stringifiedObject = {
"index.analysis.analyzer.standard_lower_ascii.type" : "custom",
"index.refresh_interval" : "60s",
"index.analysis.analyzer.standard_lower_ascii.filter.0" : "standard",
"index.analysis.analyzer.remove_whitespaces.filter.1" : "remove_whitespaces",
"index.analysis.filter.remove_whitespaces.type" : "pattern_replace",
"index.number_of_shards" : "4",
@schovi
schovi / api.js
Last active December 14, 2015 06:18
CanJS custom Api
// All calls reponses are converted into model instances or attributes are applied to current instance
var Api = can.Model('Api', {
callEndpoint: function(url) {
var ajax = this._ajax({}, url).call(this),
def = new can.Deferred(),
promise = def.promise(),
self = this;
promise.abort = ajax.abort