Skip to content

Instantly share code, notes, and snippets.

@Startouf
Startouf / google_analytics_turbolinks5.js
Created August 20, 2016 22:09
Google Analytics for Turbolinks 5 (& Rails 5)
// Google Analytics code to work with Turbolniks 5
this.GoogleAnalytics = (function() {
function GoogleAnalytics() {}
GoogleAnalytics.load = function() {
var firstScript, ga;
window._gaq = [];
window._gaq.push(["_setAccount", GoogleAnalytics.analyticsId()]);
window._gaq.push(['_setAllowAnchor', true]);
@pokka
pokka / wechat-browser-detect.js
Last active January 20, 2025 17:27 — forked from cary929/wechat-browser-detect.js
JavaScript 判断是否微信内置浏览器
// 使用 userAgent 判断是否微信内置浏览器
if( navigator.userAgent.toLowerCase().indexOf('micromessenger') > -1 || typeof navgator.wxuserAgent !== "undefined" ) {
return true;
}
@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@egerlach
egerlach / update-dokku-stack.sh
Last active December 22, 2022 03:24
Update stack underlying apps running on dokku
#!/bin/bash
# before you can use this, you need to run (as root):
# git clone https://github.com/tt/stack-images.git /root/stack-images
# git clone https://github.com/gliderlabs/herokuish.git /root/herokuish
# First, we need to get our base ubuntu images up to date
docker pull ubuntu-debootstrap:14.04
docker pull ubuntu:trusty # for postgresql

Screencapture and animated gifs

I say "animated gif" but in reality I think it's irresponsible to be serving "real" GIF files to people now. You should be serving gfy's, gifv's, webm, mp4s, whatever. They're a fraction of the filesize making it easier for you to deliver high fidelity, full color animation very quickly, especially on bad mobile connections. (But I suppose if you're just doing this for small audiences (like bug reporting), then LICEcap is a good solution).

Capturing (Easy)

  1. Launch quicktime player
  2. do Screen recording

screen shot 2014-10-22 at 11 16 23 am

@ngsmrk
ngsmrk / sidekiq_monitoring
Created August 11, 2014 11:51
Sidekiq queue checking via rails console
stats = Sidekiq::Stats.new
stats.queues
stats.enqueued
stats.processed
stats.failed
@joaodubas
joaodubas / install.sh
Created May 21, 2014 11:43
Install libxml2-python on ubuntu 14.04 by building libxml2 and libxslt1.1
#!/usr/bin/env python
# update system
apt-get -y -qq --force-yes update
# install needed system deps
apt-get -y -qq --force-yes install \
python-setuptools \
build-essential \
wget \
@KsaRedFx
KsaRedFx / install-live.sh
Last active November 27, 2024 19:14
Install Ubuntu with debootstrap and chroot, without rebooting the host machine or using a iso
#!/bin/bash
echo "--------------------------------------------------------------------------------------"
echo "This script builds a full operating system with debootstrap and chroot"
echo "To use this script, please mount an empty partition or alternate disk"
echo ""
echo "If you are using btrfs, and using subvolumes, mount the root subvolume explicity"
echo "Example: mount /dev/sdb1 /media/bootstrap -o subvol=@"
echo "Failure to do this will cause the script to break. It needs the root directory"
echo ""
echo "The script is specifically built for Ubuntu"
@markgoodyear
markgoodyear / 01-gulpfile.js
Last active May 5, 2023 03:21
Comparison between gulp and Grunt. See http://markgoodyear.com/2014/01/getting-started-with-gulp/ for a write-up.
/*!
* gulp
* $ npm install gulp-ruby-sass gulp-autoprefixer gulp-cssnano gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-notify gulp-rename gulp-livereload gulp-cache del --save-dev
*/
// Load plugins
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
autoprefixer = require('gulp-autoprefixer'),
cssnano = require('gulp-cssnano'),
@simonewebdesign
simonewebdesign / fullscreen3.js
Last active October 15, 2021 19:34
JavaScript Full Screen API (completely cross-browser!)
// quando clicco su enterfullscreen:
// vai in fullscreen
// all'entrata in fullscreen:
// mostra pulsante exitfullscreen
// nascondi header e footer
// quando clicco su exitfullscreen:
// esci da fullscreen