Skip to content

Instantly share code, notes, and snippets.

View cloudhead's full-sized avatar
🌴
On vacation

Alexis Sellier cloudhead

🌴
On vacation
View GitHub Profile

LESS 1.2.0

Now available on http://lesscss.org and NPM.

This release opens up the powerful branching capabilities of mixin guards and pattern-matching as an alternative to conditional statements.

In trying to stay as close as possible to the declarative nature of CSS, LESS has opted to implement conditional execution via guarded mixins, in the vein of @media query feature specifications:

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@cloudhead
cloudhead / gist:1591794
Created January 10, 2012 23:08
LESS 1.2.0 CHANGELOG

LESS 1.2.0 CHANGELOG

  • mixin guards
  • new function percentage
  • new color function to parse hex color strings
  • new type-checking stylesheet functions
  • fix Rhino support
  • fix bug in string arguments to mixin call
  • fix error reporting when index is 0
  • fix browser support in webkit and IE
@cloudhead
cloudhead / gist:1677036
Created January 25, 2012 16:17
Go in < 140 characters

Go in < 140 characters

if err != nil {
    return
}

Variadic argument support in LESS 1.3.0

.mixin (...) {        // matches 0-N arguments
.mixin () {           // matches exactly 0 arguments
.mixin (@a: 1) {      // matches 0-1 arguments
.mixin (@a: 1, ...) { // matches 0-N arguments
.mixin (@a, ...) {    // matches 1-N arguments
package main
func main() {
println("starting..")
go func() {
println("hello") // This never prints
}()
for {}
#!/bin/sh
set -xeo pipefail
eval $1 | eval $2
@cloudhead
cloudhead / gist:5885445
Created June 28, 2013 15:15
cloudhead's ASCII Emoticons
# cloudhead's ASCII Emoticon reference
T,T Q,Q T_T # Crying face
^,^ ^_^ # Happy face
<,< <_< # Uncertain or hesitant face
V,V V_V # Tired uncertain face, also "Sighing" face
*,* *_* # Exhausted face/Too much computer face
@,@ @_@ # Hangover face
o,o O,O # Surprised face
^.^ # Happy dog face
@cloudhead
cloudhead / bqueue.go
Created August 7, 2013 12:43
Blocking queue implementation
package queue
import "sync"
type Message string
type Queue struct {
wmu sync.Mutex
cmu sync.Mutex
slice []*Message
newtype Inventory = Inventory (IntMap (Maybe Item))
nextFreeSlot :: Inventory -> Maybe IntMap.Key
nextFreeSlot (Inventory inv) =
go $ IntMap.toAscList inv
where
go ((k, Nothing) : _) = Just k
go [] = Nothing
go (_ : xs) = go xs