This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn re-seq-with-pos | |
[re str] | |
(let [*matcher* (re-matcher re str)] | |
(loop [match (re-find *matcher*) | |
matches []] | |
(if match | |
(let [start (.start *matcher*)] | |
(recur (re-find *matcher*) | |
(conj matches {:start start :end (+ start (count (first match))) :match match}))) | |
matches)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import '[javax.script ScriptEngineManager]) | |
(let [engine (.getEngineByName (ScriptEngineManager.) "nashorn")] | |
(println (= (.eval engine "' \\r\\n' == 0") true))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// halt_elf_header *elf_header | |
void *p = (void *)elf_header + elf_header->e_shoff; | |
void *end = p + sizeof(halt_elf_section_header) * elf_header->e_shnum; | |
halt_elf_section_header *section_header; | |
for (; p < end; p += sizeof(halt_elf_section_header)) { | |
section_header = p; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$> readelf -W --program-headers target/mnt/halt/halt_kernel.elf | |
Elf file type is EXEC (Executable file) | |
Entry point 0x30 | |
There are 4 program headers, starting at offset 64 | |
Program Headers: | |
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align | |
LOAD 0x200000 0x0000000000000000 0x0000000000000000 0x00008c 0x00008c R E 0x200000 | |
NOTE 0x200000 0x0000000000000000 0x0000000000000000 0x000024 0x000024 R 0x4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns clojure-workshop-flatmap.augustl-cat) | |
(defn format-line-with-number [line n] | |
(format "%6d %s" n line)) | |
(defn line-format-noblank-numbered [line n] | |
(if (clojure.string/blank? line) | |
[line n] | |
[(format-line-with-number line n) (inc n)])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Builder<TT_REQ extends IRequest, TT_RES> { | |
private final List<Route<TT_REQ, TT_RES>> routes = new ArrayList<Route<TT_REQ, TT_RES>>(); | |
private Builder(){} | |
static public <TTT_REQ extends IRequest, TTT_RES> Builder<TTT_REQ, TTT_RES> start() { | |
return new Builder<TTT_REQ, TTT_RES>(); | |
} | |
public Builder<TT_REQ, TT_RES> add(Route<TT_REQ, TT_RES> route) { | |
this.routes.add(route); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
render: function () { | |
var self = this; | |
var state = this.state; | |
var tabIdx = 0; | |
return div( | |
null, | |
ul({className: "nav nav-tabs", key: "tabs"}, state.tabs.map(function (tab) { | |
tabIdx = tabIdx + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function myFunc() { return {wat: 5} } | |
new myFunc() // Object { wat=5} | |
new myFunc() instanceof myFunc // false | |
function otherFunc() { return 5 } | |
new otherFunc() // otherFunc {} | |
new otherFunc() instanceof otherFunc // true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<databaseChangeLog | |
xmlns="http://www.liquibase.org/xml/ns/dbchangelog" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog | |
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> | |
<changeSet id="1402072059" author="augustl"> | |
<createTable tableName="apps"> | |
<column name="id" type="int" autoIncrement="true"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns sps-server.webapp.ring-handler | |
(:require [optimus.assets :as assets] | |
[optimus.optimizations :as optimizations] | |
[optimus.strategies :as strategies] | |
[optimus.link :as link])) | |
(defn first-step-optimizations [assets options] | |
(-> assets | |
(optimizations/minify-js-assets options) | |
(optimizations/minify-css-assets options) |
OlderNewer