Skip to content

Instantly share code, notes, and snippets.

@nunosans
nunosans / html-head-boilerplate.html
Last active February 12, 2025 16:36
HTML Head Boilerplate & Reference
<!doctype html>
<html>
<head>
<!-- Priority tags. These must come first. -->
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge; chrome=1"> <!-- Render Chrome if available or using latest version of Internet Explorer (Recommended). -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<!-- Document Title -->
<title>Page Title</title>
<!-- Allows control over where resources are loaded from. Place as early in the document as possible, only applies to content below this tag. -->
@axelpale
axelpale / combinations.js
Last active October 11, 2025 20:04
JavaScript functions to calculate combinations of elements in Array.
/**
* Copyright 2012 Akseli Palén.
* Created 2012-07-15.
* Licensed under the MIT license.
*
* <license>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
@tuzz
tuzz / github.css
Last active April 4, 2026 13:49
Github Markdown Stylesheet
/*
Copyright (c) 2017 Chris Patuzzo
https://twitter.com/chrispatuzzo
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@afair
afair / bash.cheat
Created August 27, 2012 20:23
Bash Scripting Quick Reference
==========================================
BASH SCRIPTING ==========================================
========================================== TEST COMMAND
==========================================
Invoke: bash [options] file
Shebang: #!/usr/bin/env bash Test: test expression
In script: [ expression ]
========================================== Alternate: [[ espression ]]
LOOP Does not split string words
========================================== Does not expand pathglobs*
@mbostock
mbostock / .block
Last active April 19, 2025 08:19
The Gist to Clone All Gists
license: gpl-3.0
@tellnes
tellnes / generate.sh
Created November 18, 2012 21:17
Generate html files
#!/bin/bash
#
# Copyright (c) Christian Tellnes <christian@tellnes.no>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@bigfive
bigfive / change_viewport_meta.js
Created December 11, 2012 08:36
Change viewport initial scale and width depending on device width
changeViewportMeta = function() {
$('meta[name=viewport]').attr('content', 'user-scalable=yes, initial-scale=1, maximum-scale=1.3, width=device-width');
if ($(window).width() <= 320) {
return $('meta[name=viewport]').attr('content', 'user-scalable=yes, initial-scale=0.63, maximum-scale=1.3, width=480');
} else if ($(window).width() <= 480) {
return $('meta[name=viewport]').attr('content', 'user-scalable=yes, initial-scale=0.89, maximum-scale=1.3, width=480');
} else if ($(window).width() <= 768) {
return $('meta[name=viewport]').attr('content', 'user-scalable=yes, initial-scale=0.8, maximum-scale=1.3, width=920');
} else if ($(window).width() <= 1024) {
return $('meta[name=viewport]').attr('content', 'user-scalable=yes, initial-scale=0.85, maximum-scale=1.3, width=920');
@alikaragoz
alikaragoz / post.sh
Created January 1, 2013 15:25
Blog post
#!/bin/sh
# We get the path of the current directory and we move in it
DIR=$(cd "$(dirname "$0")"; pwd)
cd $DIR
# Creating full and thumbnails images folders
FULL_IMG="full"
THUMB_IMG="thumb"
mkdir $FULL_IMG
@caiguanhao
caiguanhao / crushimg.sh
Last active April 19, 2025 23:18
Recursively crush/shrink/optimize/losslessly compress PNGs, JPEGs and GIFs.
#!/bin/bash
# This is an improved script of pngfix.sh (https://gist.github.com/404909)
# which can also crush/shrink/optimize/losslessly compress JPEGs and GIFs.
# It is recommended you backup your image files before executing this script.
# Operation will be skipped if output file is bigger in size.
#
# use chmod +x crushimg.sh to make it executable and then ./crushimg.sh to run, or
# bash ./crushimg.sh to run it directly
#
# ./crushimg.sh [FILE] - (default to current directory)
@ramesaliyev
ramesaliyev / backboneHandlebarsDynamicRender.html
Last active November 3, 2020 00:52 — forked from kyleondata/gist:3440492
Backbone-Handlebars Dynamic Render
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="jquery-1.9.0.js" ></script>
<script src="handlebars-1.0.rc.2.js" ></script>
<script src="underscore-1.4.4.js" ></script>
<script src="backbone-0.9.10.js" ></script>