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
%% Copyright (c) 2008 Nick Gerakines <nick@gerakines.net> | |
%% | |
%% Permission is hereby granted, free of charge, to any person | |
%% obtaining a copy of this software and associated documentation | |
%% files (the "Software"), to deal in the Software without | |
%% restriction, including without limitation the rights to use, | |
%% copy, modify, merge, publish, distribute, sublicense, and/or sell | |
%% copies of the Software, and to permit persons to whom the | |
%% Software is furnished to do so, subject to the following | |
%% conditions: |
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
/** | |
* A `tail -f` implementation in Node.js. | |
* | |
* Bratish Goswami | |
* bratishgoswami AT gmail DOT com | |
* | |
*/ | |
var sys = require("sys"), | |
fs = require('fs'), |
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
// | |
// Regular Expression for URL validation | |
// | |
// Author: Diego Perini | |
// Created: 2010/12/05 | |
// Updated: 2018/09/12 | |
// License: MIT | |
// | |
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it) | |
// |
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
(defmacro def-curry-fn [name args & body] | |
{:pre [(not-any? #{'&} args)]} | |
(if (empty? args) | |
`(defn ~name ~args ~@body) | |
(let [rec-funcs (reduce (fn [l v] | |
`(letfn [(helper# | |
([] helper#) | |
([x#] (let [~v x#] ~l)) | |
([x# & rest#] (let [~v x#] | |
(apply (helper# x#) rest#))))] |
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 sunil.curry) | |
(defn partial+ | |
"Takes a function f and fewer than the normal arguments to f, and | |
returns a fn that takes a variable number of additional args. When | |
called, the returned function calls f with args + additional args. | |
differs from the core version in that it works on just one argument." | |
{:added "1.0"} | |
([f] f) | |
([f arg1] |
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
# | |
# uncrustify config file for objective-c and objective-c++ | |
# | |
indent_with_tabs = 0 # 1=indent to level only, 2=indent with tabs | |
output_tab_size = 4 # new tab size | |
indent_columns = output_tab_size | |
indent_label = 2 # pos: absolute col, neg: relative column | |
indent_align_assign = FALSE |
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
;;; Global clock implementation of Life. | |
(defmodule life_sync_cell | |
(export (start_link 1) (set_neighbours 2) (tick 1) | |
(init 1) (handle_cast 2)) | |
(using gen_server) | |
(behaviour gen_server)) | |
(include-file "deps/lfe_utils/include/using.lfe") | |
;;; Exported: |
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 one-lineres) | |
;; 1. Multiple Each Item in a List by 2 | |
(map #(* 2 %) (range 1 11)) | |
;; 2. Sum a List of Numbers | |
(reduce + (range 1 1001)) | |
;; 3. Verify if Exists in a String | |
(def words #{"scala" "akka" "play framework" "sbt" "typesafe"}) |
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"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Ansi 0 Color</key> | |
<dict> | |
<key>Blue Component</key> | |
<real>0.19370138645172119</real> | |
<key>Green Component</key> | |
<real>0.15575926005840302</real> |
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
%%% This is a clever Erlang macro that given a record name will create a new function | |
%%% that converts from a property list to the record (which really is a taged tuple). | |
-define(proplist_to_record(Record), | |
fun(Proplist) -> | |
Fields = record_info(fields, Record), | |
[Tag| Values] = tuple_to_list(#Record{}), | |
Defaults = lists:zip(Fields, Values), | |
L = lists:map(fun ({K,V}) -> proplists:get_value(K, Proplist, V) end, Defaults), | |
list_to_tuple([Tag|L]) |
OlderNewer