Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/* Feedly */
#feedlyCenter * {
font-family: "Segoe UI", sans-serif !important;
}
#feedlyCenter code,
#feedlyCenter pre {
font-family: "Consolas", monospace !important;
}
'use strcit';
var path = require('path');
module.exports = function (grunt) {
var config = {
pkg: grunt.file.readJSON('package.json')
};
grunt.file.expand('.grunt/config/*.json').forEach(function (file) {
@anilex
anilex / center-float-div.html
Created March 5, 2014 13:27
Center float div with variable width
#wrap {
float: left;
position: relative;
left: 50%;
}
#content {
float: left;
position: relative;
left: -50%;
// http://gmap3.net/forum/viewtopic.php?pid=3280#p3280
// the image is 50x78px and and it scaled down to 25x39px.
var markerIcon = new google.maps.MarkerImage('map-icon.png', null, null, null, new GMaps.Size(25, 39));
var marker = new google.maps.Marker({
icon: markerIcon,
(function($) {
get_device_pixel_ratio = function() {

Free inactive memory on linux

sudo -s
...
free && sync && echo 3 | sudo tee /proc/sys/vm/drop_caches && echo "" && free

Free inactive memory on Mac OS X

/**
* Validate an email address.
*/
var validate_email_address = function(email_address) {
// TODO: This does not support using "+" in email addresses and it also seems
// to assume that the top level domain can only be three characters long.
// I coped this from somewhere. Need to revisit it. It works as a quick
// rule of thumb to reduce the amount of work that needs to be done by
// hand for the task at hand today.
if (/.+@.+\..+/i.test(email_address)) {
/**
* Track JS error details in Universal Analytics
*/
function trackJavaScriptError(e) {
var errMsg = e.message;
var errSrc = e.filename + ': ' + e.lineno;
ga('send', 'event', 'JavaScript Error', errMsg, errSrc, { 'nonInteraction': 1 });
}
//http://simonsmith.io/writing-amd-compatible-plugins-for-jquery/
// UMD dance - https://github.com/umdjs/umd
!function(root, factory) {
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
factory(root.jQuery);
}
}(this, function($) {
@anilex
anilex / scroll-top.js
Created July 15, 2014 21:04
Scroll Top
// http://codyhouse.co/demo/back-to-top/
jQuery(document).ready(function($) {
// browser window scroll (in pixels) after which the "back to top" link is shown
var offset = 300,
//browser window scroll (in pixels) after which the "back to top" link opacity is reduced
offset_opacity = 1200,
//duration of the top scrolling animation (in ms)
scroll_top_duration = 700,
//grab the "back to top" link
$back_to_top = $('.cd-top');