Skip to content

Instantly share code, notes, and snippets.

View Saturate's full-sized avatar
🛠️
Building Stuff

Allan Kimmer Jensen Saturate

🛠️
Building Stuff
View GitHub Profile
autoSize: function() {ULSTYE:;
var $v_0 = 0;
var $v_1 = 0;
this.$Q_0((SP.ScriptUtility.isNullOrUndefined(this.$G_0.width)) ? 500 : this.$G_0.width, (SP.ScriptUtility.isNullOrUndefined(this.$G_0.height)) ? 20 : this.$G_0.height);
if (this.$0_0) {
try {
var $v_2 = this.$0_0.contentWindow.document;
var $v_3 = $v_2.getElementById('s4-ribbonrow');
var $v_4 = $v_2.getElementById('s4-workspace');
if ($v_3 && $v_4) {
@Saturate
Saturate / gist:3854827
Created October 8, 2012 20:39
How UFMM mod files could work.
// ## Replace ##
// Mod
<ufmm:replace type="textList" name="TEXT_LIST">
<text>New Text</text>
</ufmm:replace>
// Source
<textList name="TEXT_LIST">
<text>Old Text</text>
</textList>

Snow in canvas land

Other people's code is awful, and your own code from months previous counts as someone else's. With this and the festive spirit in mind, I dug up a canvas snow demo I made two years ago to see how bad my code really was.

Turns out the performance landscape has changed quite a bit, but after applying a couple of workarounds, best practices, and memory management, I got the demo running smoother than it ever did.

Ugh, I can't believe I just wrote "performance landscape". Anyway...

How does the demo work?

@Saturate
Saturate / InstallationAfYeoman.md
Last active December 10, 2015 21:08
Sådan installere du Yeoman på Windows.

#Installation af Yeoman Der er to måder du kan installere Yeoman på windows lige nu, en automatisk fra en package manager, og den langsomme manuelle.

Automatisk installation

Benytter chocolatey til at installere dependencies.

"Chocolatey NuGet is a Machine Package Manager, somewhat like apt-get, but built with Windows in mind."

Trin 1 - Installer Chocolatey

Skriv følgende kode i CMD og tryk Enter.

window.onerror = function(msg, url, line) {
var loggerUrl = "/log/js";
var parameters = "?description=" + escapemsg
+ "&url=" + escape(url)
+ "&line=" + escape(line)
+ "&parent_url=" + escape(document.location.href)
+ "&user_agent=" + escape(navigator.userAgent);
/* Send error to the server by loading this as a image url. It will work as a GET request */
new Image().src = loggerUrl + parameters;
@Saturate
Saturate / custom.js
Last active December 11, 2015 18:39
function toggleHeader(e) {
$('.header-user-info')
.css({opacity: 0.0, visibility: "visible"})
.animate({marginTop: '0px', opacity: 1.0}, 500);
$('.header-close-user-info')
.css({opacity: 0.0, visibility: "visible", display: "inline-block"})
.animate({opacity: 1.0}, 500);
$('.overlay')
.css({opacity: 0.0, visibility: "visible"})
.animate({opacity: 0.7}, 500);
@Saturate
Saturate / README.md
Last active December 18, 2015 21:49
Hashtag Maker 3000

Will make some awesome hashtags, punk.

// method used by requirejs to decide which modules to include
// since we want to be able to package a bunch of modules in both
// public internet area as well as in edit mode
var includeModulesByFolder = function(folder, baseIncludes){
var fs = require('fs'),
glob = require('glob'),
include = [],
baseIncludes = typeof baseIncludes !== 'undefined' ? baseIncludes : [];
glob.sync( folder + '/**/*.js', { dot: false }).forEach(function(filename) {
@Saturate
Saturate / yammer-group-download-all-files.js
Last active March 2, 2022 15:45
Download all files in a Yammer.com group. You have to enable popups. Only tested in chrome.
/*
# How to use:
1. Navigate to the files tab (https://www.yammer.com/COMPANY/groups/GROUP/uploaded_files)
2. Press F12.
3. Paste script in console and run it.
4. Enjoy downloading files!
# Not working?
1. Enable popups
@Saturate
Saturate / unicoin-automine.js
Last active August 29, 2015 13:57
Unicoin StackOverflow Auto Miner
// How to use it:
// Copy paste to your console (Press F12), and run it (Enter)!
// Now you are rich! Or soon...
var fkey = StackExchange.options.user.fkey || $("input[name=fkey]").val(); // I have no idea what the fkey is
var totalCoinsMined = 0;
console.log('Your fkey is: ' + fkey);
var mineSomeUnicoins = function() {