Skip to content

Instantly share code, notes, and snippets.

@flesler
flesler / index.html
Last active September 11, 2021 13:16
Anchor navigation powered by jquery.scrollTo
<!-- Include jQuery from somewhere, must use version 1.8 or above -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script>
<!-- Initialize the plugin, the contents of the script can be inlined here, of course -->
<script type="text/javascript" src="js/init.js"></script>
@prefinery
prefinery / prefinery-resize.js
Last active August 29, 2015 14:15
Dynamically resize Prefinery embedded Application Form
<script type="text/javascript">
var PrefineryEventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var PrefineryReceiveMessage = window[PrefineryEventMethod];
var PrefineryMessageEvent = PrefineryEventMethod == "attachEvent" ? "onmessage" : "message";
PrefineryReceiveMessage(PrefineryMessageEvent, function(e) {
var message = e.data.split('|');
if (message[0] == "PrefineryIFrameHeight") {
document.getElementById('prefinery_iframe_inline').style.height = message[1] + "px";
}
@supinf
supinf / s3-invalidation.js
Last active January 7, 2023 08:57
AWS Lambda script:: CloudFront Invalidations which are triggered by s3 events.
console.log('Loading event');
var Q = require('q');
var aws = require('aws-sdk');
var cloudfront = new aws.CloudFront();
exports.handler = function (event, context) {
//_log('Received event: ', event);
var bucket = event.Records[0].s3.bucket.name;
@KittyGiraudel
KittyGiraudel / SassMeister-input.scss
Created April 22, 2014 09:41
Generated by SassMeister.com.
// ----
// Sass (v3.3.8)
// Compass (v1.0.0.alpha.19)
// ----
// A clean way to deal with z-index layers in Sass
// Based on http://css-tricks.com/handling-z-index/
// ---
// A map of z layers
@toolmantim
toolmantim / Makefile
Last active August 21, 2024 20:56
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
@chadbailey59
chadbailey59 / post-merge
Last active December 11, 2015 22:29
save this as `.git/hooks/post-merge` in any of your repos. Then, when you do a `git pull` (or really any merge I think), if any migrations were updated or the Gemfile was edited, you'll get a handy reminder to migrate or bundle install.
#!/usr/bin/env ruby
# Put me in .git/hooks/post-merge
# Then do chmod a+x .git/hooks/post-merge
migrations = `git diff --name-only master master@{1} | grep db/migrate | wc -l`.strip.to_i
if migrations > 0
puts " "
puts "**************************************************************"
puts "**************************************************************"
@media only screen and (min-width: 320px) {
/* Small screen, non-retina */
}
@media
only screen and (-webkit-min-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( min--moz-device-pixel-ratio: 2) and (min-width: 320px),
only screen and ( -o-min-device-pixel-ratio: 2/1) and (min-width: 320px),
@emilbjorklund
emilbjorklund / breakpoints_via_css.html
Created April 24, 2012 16:03
Width detection via sneaky CSS rules
<!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 */
@vasilisvg
vasilisvg / more.md
Last active December 4, 2020 04:48
This is my backup script which syncs my server to my dropbox every day.

The script below is triggered every day from my Mac. I use Hazel to move the tar.gz to an external hard disk once it's finished. This happens every day without me noticing. You can exclude folders if you want to. You probably want to exclude giant cache folders.

You should have a similar script.

@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#