Skip to content

Instantly share code, notes, and snippets.

View sshyran's full-sized avatar
:octocat:
Dev

Serhii Shyran sshyran

:octocat:
Dev
View GitHub Profile
@mathiasbynens
mathiasbynens / jquery.preload.js
Created April 22, 2010 17:11
JavaScript preload() function
/*!
* $.preload() function for jQuery – http://mths.be/preload
* Preload images, CSS and JavaScript files without executing them
* Script by Stoyan Stefanov – http://www.phpied.com/preload-cssjavascript-without-execution/
* Slightly rewritten by Mathias Bynens – http://mathiasbynens.be/
* Note that since this script relies on jQuery, the preloading process will not start until jQuery has finished loading.
*/
jQuery.preload = function(array) {
var length = array.length,
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
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
# Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType font/x-woff .woff
AddType image/svg+xml .svg
# Compress compressible fonts
AddOutputFilterByType DEFLATE font/ttf font/otf image/svg+xml
@peterkappus
peterkappus / haml-sass builder
Created August 24, 2011 23:33
Haml/Sass builder script (great for Wordpress themes & other HTML-like templates)
require 'digest/md5'
=begin
About:
This script automatically runs on a 2-second loop, searches the current directory for haml & sass files that have been modified since the last iteration and builds them as needed into a file with the same name minus the .haml/sass extension. I wrote it so I could use Haml & Sass to develop Wordpress themes.
How-to:
1) Name your source files with the extension you'd like them to have, then add ".haml" or ".sass" as appropriate...
For example: index.php.haml and styles.css.sass
@dstufft
dstufft / desc.txt
Last active April 1, 2021 12:58
A list of package versions that are only installable externally from PyPI and the script to generate missing.json.
Unscientific Study.
- Took 54 hours, state of PyPI changed during it (and since).
- Might have bugs, reasonably sure it's accurate though.
- Lists only the versions that pip's PackageFinder could not locate a version on PyPI but
could outside of PyPI.
- List won't update, projects may have resolved since posting it.
Some statistics:
@mrinterweb
mrinterweb / svgoptimize
Created April 25, 2014 21:21
Command line SVG optimizer and base64 converter for CSS
#! /usr/bin/env ruby
# nokogiri is required below unless --no-modify option is specified
require 'optparse'
require 'tempfile'
@options = {}
OptionParser.new do |opts|
opts.banner = "Usage: svgoptimize [options] <path-to-svg-file>"
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@hdragomir
hdragomir / sm-annotated.html
Last active July 27, 2024 15:01
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@edouard-lopez
edouard-lopez / libsass-install.bash
Last active October 17, 2019 17:17
Installing/Compiling libsass and sassc on Ubuntu 14.04+/Linux Mint 17+ (needed by node-sass)
# Based on https://github.com/sass/libsass/wiki/Building-with-autotools
# Install dependencies
apt-get install automake libtool
# Fetch sources
git clone https://github.com/sass/libsass.git
git clone https://github.com/sass/sassc.git libsass/sassc
# Create configure script
import requests
import re
import sys
tags = ['', 'python', 'javascript', 'django', 'web', 'google', 'java', 'ajax',
'rails', 'plugin', 'android', 'cplusplus', 'mysql', 'dotnet', 'game',
'appengine', 'php', 'flash', 'jquery', 'database', 'gwt']
seen_tags = set(tags)