Skip to content

Instantly share code, notes, and snippets.

for i in {1..10}; do haml -f html5 -q haml/test.haml test/test_${i}.html; done
arr = [1,2,3,4,55]
Math.max.apply(null, arr)
@shapkarin
shapkarin / ls count.sh
Last active August 29, 2015 14:05
count files in derictory
ls -l dir/ | grep -v ^l | wc -l
@shapkarin
shapkarin / arabian regex
Created August 15, 2014 20:31
is arabic letters?
/^[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufc3f]|[\ufe70-\ufefc]+$/
@shapkarin
shapkarin / type-one.js
Last active August 29, 2015 14:06
Typewriter Effect Implementations (with JQuery)
//this solution is much better
function typewriter(text, name){
var input = form.find('input[name="'+ name + '"]').val('')[0],
s = text.split('').reverse(),
len = s.length-1,
var initInterval = setInterval(function(){
if( s.length ){
var c = s.pop();
input.value += c;
@shapkarin
shapkarin / solution.js
Last active February 13, 2019 09:08
test task redundancy remix)
var salary = employees.reduce(function (result, employee) {
return result + (employee.sex === 'female') ? employee.salary : false /*or 0*/;
}, 0);
console.log(salary);
@shapkarin
shapkarin / animations.styl
Last active August 29, 2015 14:06
part from from styles
.pages
.page
&.develop.anim
background darken($green, 10%)
backTrans()
.inner
@shapkarin
shapkarin / transparency.styl
Last active August 29, 2015 14:06 — forked from hellosmithy/transparency.styl
Cross-browser alpha transparent background CSS (rgba) Stylus mixin (forked to save)
// background transparency
background-transparency(color, alpha = 1)
ms-color = argb(color, alpha)
background rgb(color)
background rgba(color, alpha)
.lt-ie8 &
zoom 1
.lt-ie9 &
background transparent
filter s('progid:DXImageTransform.Microsoft.gradient(startColorstr=%s,endColorstr=%s)', ms-color, ms-color)
@shapkarin
shapkarin / curiosity.js
Last active March 11, 2022 08:57
curiosity.js
/*
. .-.
| `-.
`-' `-'
*/
[] + {}
// "[object Object]"
{} + []
// 0
var Increment = function() {
this.int = 0;
};
Increment.prototype.toString = function() {
return ++this.int;
};
var increment = new Increment();