Skip to content

Instantly share code, notes, and snippets.

View hsnaydd's full-sized avatar

Hasan Aydoğdu hsnaydd

View GitHub Profile

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

@mathewbyrne
mathewbyrne / slugify.js
Created October 12, 2011 04:34
Javascript Slugify
function slugify(text)
{
return text.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
}
@paulirish
paulirish / rAF.js
Last active June 11, 2024 14:29
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@tbranyen
tbranyen / bad-idea.js
Last active October 1, 2015 12:48
Get all the argument names from a given function
// Get the argument names from a given function
Function.prototype.args = function() {
// First match everything inside the function argument parens
var args = this.toString().match(/function\s.*?\(([^)]*)\)/)[1];
// Split the arguments string into an array comma delimited
return args.split(", ").map(function(arg) {
// Ensure no inline comments are parsed and trim the whitespace
return arg.replace(/\/\*.*\*\//, "").trim();
}).filter(function(arg) {
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@ekrembk
ekrembk / sehir_tespiti.js
Created November 6, 2012 10:14
Kullanıcının şehrini Javascript ile otomatik tespit etme. HTML5 Geocoding API ve Reverse Geocoding için Yandex Geocoder kullanıldı.
function otomatikBul() {
// Browser desteğini kontrol et
if( ! navigator.geolocation ) {
console.log( 'Broserınız desteklemiyor. Lütfen manual seçim yapınız.' );
return;
}
// Uyarı
console.log( 'Koordinatlar alınıyor...' );
@alexcican
alexcican / retina-media-query.css
Created February 6, 2013 21:57
CSS3 Media Query for serving different images on retina devices
/* future proof retina targetting */
@media (-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 1.5), (min-device-pixel-ratio: 1.5), (min-resolution: 144dpi), (min-resolution: 1.5dppx), {
}
@paulirish
paulirish / gist:5537058
Last active December 9, 2018 02:16
jQuery.fn.closest equivalent in DOM js
// starting with current element, look up the DOM ancestor tree to see if anything matches the given selector
// returns element if found
// returns false if not found
function closest(elem, selector) {
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;
while (elem) {
@matthiasg
matthiasg / docs style (bootstrap)
Created August 5, 2013 06:26
the callouts from the bootstrap documentation
/* Side notes for calling out things
-------------------------------------------------- */
/* Base styles (regardless of theme) */
.bs-callout {
margin: 20px 0;
padding: 15px 30px 15px 15px;
border-left: 5px solid #eee;
@ademilter
ademilter / basicss.css
Last active September 19, 2020 19:23
web uygulamalari icin temel stilleri olusturur. varsayilan kenar bosluklarini ortadan kaldirir ve tipografik duzeltmeler yapar. normalize.css'ten hemen sonra gelmelidir.
/**
* 1. http://www.paulirish.com/2012/box-sizing-border-box-ftw/
* http://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/
* http://fatihhayrioglu.com/css3-box-sizing-ozelligi/
*
* 2. http://aestheticallyloyal.com/public/optimize-legibility/
*
* 3. http://maxvoltar.com/archive/-webkit-font-smoothing
*
* 4. http://maximilianhoffmann.com/posts/better-font-rendering-on-osx