Skip to content

Instantly share code, notes, and snippets.

@mario4000
mario4000 / FontAwesome CDN
Created December 12, 2017 10:08 — forked from marceloag/FontAwesome CDN
FontAwesome CDN
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
@mario4000
mario4000 / less.less
Created November 18, 2017 04:18 — forked from paulmillr/less.less
Sass vs Stylus vs LESS
.border-radius (@radius) {
-webkit-border-radius: @radius;
-o-border-radius: @radius;
-moz-border-radius: @radius;
-ms-border-radius: @radius;
border-radius: @radius;
}
.user-list {
// need to use special `.` syntax
def binary_search(target, list)
position = (list.count / 2).floor
mid = list[position]
return mid if mid == target
if(mid < target)
return binary_search(target, list.slice(position + 1, list.count/2))
else
return binary_search(target, list.slice(0, list.count/2))
a = []
a.push(1) # enqueue the number 1 in the queue
a.push(2) # enqueue the number 2 in the queue
a.push(3) # enqueue the number 3 in the queue
# dequeue the first element, 1 has been in the queue longest
puts a.shift # => displays 1
a.push(4) # enqueue the number 4 in the queue
@mario4000
mario4000 / async-foreach.js
Created October 8, 2017 02:08 — forked from atinux/async-foreach.js
JavaScript: async/await with forEach()
const waitFor = (ms) => new Promise(r => setTimeout(r, ms))
const asyncForEach = (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const start = async () => {
await asyncForEach([1, 2, 3], async (num) => {
await waitFor(50)