Skip to content

Instantly share code, notes, and snippets.

View renestalder's full-sized avatar

René Stalder renestalder

View GitHub Profile
@renestalder
renestalder / _README.md
Last active August 29, 2015 14:20
A (cross-browser) CSS utility class for preserving pixels when scaling up images
@renestalder
renestalder / README.md
Last active May 3, 2024 14:08
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.

@renestalder
renestalder / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@renestalder
renestalder / groupArray.js
Created August 21, 2014 12:24
Group Array Items
function groupBy( array , f )
{
var groups = {};
array.forEach( function( o )
{
var group = JSON.stringify( f(o) );
groups[group] = groups[group] || [];
groups[group].push( o );
});
return Object.keys(groups).map( function( group )
@renestalder
renestalder / functions.php
Created June 24, 2014 12:32
WordPress redirect if not logged in or public available site
<?php
function redirect_beta() {
if ( !is_user_logged_in() && !is_page('slug or page ID') && $_SERVER['PHP_SELF'] != '/wp-admin/admin-ajax.php' ) {
wp_redirect( 'http://example.com', 302);
exit;
}
}
add_action( 'template_redirect', 'redirect_beta' );
@renestalder
renestalder / _navigation.scss
Created February 21, 2014 13:22
Mobile Medium Sidebar
.container {
-webkit-transition: -webkit-transform .2s cubic-bezier(0.2,0.3,0.25,0.9);
-moz-transition: -moz-transform .2s cubic-bezier(0.2,0.3,0.25,0.9);
-o-transition: -o-transform .2s cubic-bezier(0.2,0.3,0.25,0.9);
transition: transform .2s cubic-bezier(0.2,0.3,0.25,0.9);
}
.button--site-nav-trigger {
@include button($bg: #000, $is-input: true);
@renestalder
renestalder / _rem-fallback.scss
Last active January 4, 2016 19:09
ZURB Foundation px Fallback for rem
// Foundation settings example
$base-font-size: 62.5%;
$rem-base: 10px;
// Mixin using rem-calc from ZURB Foundation, but adding pixel fallback
@mixin rem-fallback($property, $values, $base-value: $rem-base){
#{$property}: $values;
#{$property}: rem-calc($values, $base-value: $rem-base);
}
<?php
// Variables used in this script:
// $summary - text title of the event
// $datestart - the starting date (in seconds since unix epoch)
// $dateend - the ending date (in seconds since unix epoch)
// $address - the event's address
// $uri - the URL of the event (add http://)
// $description - text description of the event
// $filename - the name of this file for saving (e.g. my-event-name.ics)
//
function inferInputModel() {
if (window.navigator.msPointerEnabled) {
return 'pointer';
} else if (window.ontouchstart !== undefined) {
return 'touch';
} else {
return 'unknown';
}
}
@import "compass/css3/background-size";
// $sprites: sprite-map("../images/sprite/normal/*.png");
// $sprites-retina: sprite-map("../images/sprite/retina/*.png");
// $sprite-width: 363px;
@mixin sprite-background($name) {
$sprite-url: sprite-url($sprites);
$sprites-retina-url: sprite-url($sprites-retina);
background-image: url(sprite-path($sprites));