Skip to content

Instantly share code, notes, and snippets.

@michiakig
michiakig / ants.clj
Created July 19, 2011 22:37
Clojure ant sim from Rich Hickey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Ant sim ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright (c) Rich Hickey. All rights reserved.
; The use and distribution terms for this software are covered by the
; Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
; which can be found in the file CPL.TXT at the root of this distribution.
; By using this software in any fashion, you are agreeing to be bound by
; the terms of this license.
; You must not remove this notice, or any other, from this software.
;dimensions of square world
@artpolikarpov
artpolikarpov / doubleHover.js
Created August 22, 2012 19:51
Cинхронное подсвечивание одинаковых ссылок: http://artgorbunov.ru/bb/soviet/20120823/
/*
Функция для одновременной подсветки ссылок с одинаковым href,
на вход принимает:
1) selector — джеквери-селектор ссылок, чтобы
была возможность включить дублирующую подсветку в определённом фрагменте;
2) hoverClass — какой класс добавить по ховеру и псевдо-ховеру.
Инициализация для всего документа:
doubleHover('a', 'hover');
@jaymcgavren
jaymcgavren / javascript_objects.md
Last active September 12, 2018 09:23
In this screencast, Jay McGavren gives you a clear, no-nonsense look at Javascript objects. You'll learn how properties and functions are woven together to make a complete object. You'll learn what's special about constructor functions (not that much), and how prototypes form the basis for creating new objects. If you're ready to take the next s…

Objects

To create a new object, use the new keyword followed by a call to a constructor function. Javascript provides the Object() constructor out-of-the-box:

var toilet = new Object();

Properties

Once you have an object, you can set and get properties on it, like this:

@pepelsbey
pepelsbey / CSSDay.md
Last active April 12, 2016 13:00
Текстовая трансляция с конференции CSS Day в Амстердаме 14 июня — http://cssday.nl

Прямо сейчас в Амстердаме начинается конференция CSS Day и мы решили попробовать новый формат и сделать текстовую трансляцию в течение дня. Программа: http://cssday.nl/programme

Первый доклад

Эрик Мейер про веб-шрифты в CSS — http://cssday.nl/programme#eric-meyer

  • Не забывайте указывать локальные (несколько, при возможности) псевдонимы для шрифтов в @font-face, на случай, если шрифты уже установлены.

  • Если оформление заголовков в тексте веб-шрифтом ещё нормально, то оформление всего текста вызвает проблемы с быстродействием на мобильных.

@logicmason
logicmason / yc.js
Last active June 18, 2021 01:46
Y combinator in JavaScript and factorial function example (recursion with all anonymous functions)
var Y = function(proc) {
return (function(x) {
return proc(function(y) { return (x(x))(y);});
})(function(x) {
return proc(function(y) { return (x(x))(y);});
});
};
var factgen = function(fact) {
return function(n) {
@mozmorris
mozmorris / composer.json
Last active July 8, 2016 06:51
example php app using php's built-in server (npm run backend)
{
"name": "MozMorris/phpapp",
"require": {
"slim/views": "~0.1.3",
"twig/twig": "~1.0"
}
}
@zchee
zchee / actionlist.vim
Last active June 23, 2024 17:32
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@paulirish
paulirish / what-forces-layout.md
Last active June 26, 2024 20:47
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@moklett
moklett / task1.exs
Last active May 7, 2024 09:59
Elixir Task - Crash Handling
# This demonstrates that, when using async/await, a crash in the task will crash the caller
defmodule Tasker do
def good(message) do
IO.puts message
end
def bad(message) do
IO.puts message
raise "I'm BAD!"
end
@fasiha
fasiha / learn_datalog_today.clj
Created May 10, 2016 03:32
Learn Datalog Today ported to DataScript & Clojure (JVM)
; Learn Datalog Today (http://www.learndatalogtoday.org) is a great resource for
; reading but its interactive query interface is broken. Below is how we can
; load the same data into a Clojure REPL and play with it using DataScript.
; After running the code below, many/most/all? of the queries on Learn Datalog
; Today should be functional.
;
; Create a new lein project, add `[datascript "0.15.0"]` to `project.clj`'s
; `dependencies`, run `lein deps && lein repl` and copy-paste the following in
; chunks, inspecting the outputs as needed.