Skip to content

Instantly share code, notes, and snippets.

@culttm
culttm / msx.js
Last active August 29, 2015 14:05
Возвращает максимальное значение массива без помощи встроенной функции
var numbers = [100, 200, 150, 50, 250];
var max = function(array){
var arrayLen = array.length;
var number;
if (arrayLen){
number = array[0];
for (var x = 0; x < arrayLen; x+=1){
if (number < array[x]){
number = array[x];
@culttm
culttm / grayscale
Last active August 29, 2015 14:07
Safari grayscale jquery
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
var grayscale=function(){var e={colorProps:["color","backgroundColor","borderBottomColor","borderTopColor","borderLeftColor","borderRightColor","backgroundImage"],externalImageHandler:{init:function(e,t){if(e.nodeName.toLowerCase()==="img"){}else{r(e).backgroundImageSRC=t;e.style.backgroundImage=""}},reset:function(e){if(e.nodeName.toLowerCase()==="img"){}else{e.style.backgroundImage="url("+(r(e).backgroundImageSRC||"")+")"}}}},t=function(){try{window.console.log.apply(console,arguments)}catch(e){}},n=function(e){return(new RegExp("https?://(?!"+window.location.hostname+")")).test(e)},r=function(){var e=[0],t="data"+ +(new Date);return function(n){var r=n[t],i=e.length;if(!r){r=n[t]=i;e[r]={}}return e[r]}}(),i=function(e,t,n){var s=document.createElement("canvas"),u=s.getContext("2d"),a=e.naturalHeight||e.offsetHeight||e.height,f=e.naturalWidth||e.offsetWidth||e.width,l;s.height=a;s.width=f;u.drawImage(e,0
@culttm
culttm / scss-animation
Created October 14, 2014 11:05
Get simple animation with compass and gem animation
//https://github.com/ericam/compass-animation
@import "animation";
#circle {
width: 50px;
height: 50px;
background: none;
border-radius: 50%;
box-shadow: rgba(255,255,255,0.2) 160px 335px,rgba(255,255,255,0.2) 120px 275px 0 12px,rgba(255,255,255,0.2) 60px 355px 0 23px,rgba(255,255,255,0.2) 230px 445px 0 -8px,rgba(255,255,255,0.2) 60px 125px,rgba(255,255,255,0.2) 260px 145px 0 12px,rgba(255,255,255,0.2) 300px 145px 0 23px,rgba(255,255,255,0.2) 100px 85px 0 -8px,rgba(255,255,255,0.2) 50px 155px,rgba(255,255,255,0.2) 150px 273px 0 -2px,rgba(255,255,255,0.2) 50px 555px 0 23px,rgba(255,255,255,0.2) 180px 5px 0 -8px;
// ----
// Sass (v3.3.7)
// Compass (v)
// ----
@import 'compass';
$btn-colors: (
default: (
// SmoothScroll for websites v1.2.1
// Licensed under the terms of the MIT license.
// People involved
// - Balazs Galambosi (maintainer)
// - Michael Herf (Pulse Algorithm)
(function(){
// Scroll Variables (tweakable)
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@mixin breakpoint($min: 0, $max: 0) {
$type: type-of($min);
@if $type == string {
@if $min == xs {
@media (max-width: 767px) { @content; } // Mobile Devices
}
@else if $min == sm {
@media (min-width: 768px) { @content; } // Tablet Devices
@culttm
culttm / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!DOCTYPE html>
<!--[if IE 8]> <html lang="sv-SE" class="no-js ie8"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="sv-SE" class="no-js"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>Breakpoint detection test</title>
<style type="text/css" media="screen">
@media screen and (min-width: 320px) {
#page:after {
content: 'smallest'; /* represent the current width-bracket */
@culttm
culttm / _grab.scss
Last active August 29, 2015 14:15 — forked from shiwano/_grab.scss
@charset "UTF-8";
@mixin grab-cursor {
// http://www.google.com/intl/en_ALL/mapfiles/openhand.cur
cursor: url('data:image/vnd.microsoft.icon;base64,AAACAAEAICACAAcABQAwAQAAFgAAACgAAAAgAAAAQAAAAAEAAQAAAAAAAAEAAAAAAAAAAAAAAgAAAAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD8AAAA/AAAAfwAAAP+AAAH/gAAB/8AAA//AAAd/wAAGf+AAAH9gAADbYAAA2yAAAZsAAAGbAAAAGAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////gH///4B///8Af//+AD///AA///wAH//4AB//8AAf//AAD//5AA///gAP//4AD//8AF///AB///5A////5///8='), all-scroll;
// cursor: -webkit-grab;
cursor: -moz-grab;
cursor: -o-grab;
cursor: -ms-grab;
cursor: grab;