Skip to content

Instantly share code, notes, and snippets.

@bojanbjelic
bojanbjelic / fixuser.sql
Created January 26, 2013 00:08
Fix strange mysql ownership issues.
UPDATE `mysql`.`proc` p SET definer = 'user@localhost' WHERE definer='user@%' AND db='DB';
@bojanbjelic
bojanbjelic / git-assume-unchanged.sh
Created January 26, 2013 01:32
git: temporarily ignore local changes
git update-index --assume-unchanged database.php
// Save as animated GIF
// Requires gifAnimation Processing Library
// http://www.extrapixel.ch/processing/gifAnimation/
import gifAnimation.*;
GifMaker gifExport;
boolean saveToGif = true;
// The time between GIF frames
int frameDelay = 60;
// Save as animated GIF
// Requires gifAnimation Processing Library
// http://www.extrapixel.ch/processing/gifAnimation/
import gifAnimation.*;
GifMaker gifExport;
boolean saveToGif = true;
// The time between GIF frames
int frameDelay = 50;
// Save as animated GIF
// Requires gifAnimation Processing Library
// http://www.extrapixel.ch/processing/gifAnimation/
import gifAnimation.*;
GifMaker gifExport;
boolean saveToGif = false;
// The time between GIF frames
int frameDelay = 60;
// Save as animated GIF
// Requires gifAnimation Processing Library
// http://www.extrapixel.ch/processing/gifAnimation/
import gifAnimation.*;
GifMaker gifExport;
boolean saveToGif = false;
// The time between GIF frames
int frameDelay = 60;
// Create a symmetrical diamond shaped (sideways square) snowflake.
// Create 1/8th of the shape and reflect that for the remaining 7/8ths.
// Make it a repeatable function with a parameter for the center XY.
// New pattern generated on key press.
// Animated GIF generated and saved on form unload.
// ToDo: Store as class? Then it would be copyable.
// Save as animated GIF
// Create a symmetrical diamond shaped (sideways square) "snowflake".
// This can be rotated 45° to make a square.
// Create 1/8th of the shape and reflect that for the remaining 7/8ths.
// Make it a repeatable function with a parameter for the center XY.
// New pattern generated on key press.
// Animated GIF generated and saved on form unload.
// ToDo: Store as class? Then it would be copyable...
// Keys:
@bojanbjelic
bojanbjelic / csv.sql
Created May 29, 2013 09:51
sql server csv
SELECT distinct
SUBSTRING((SELECT ',' + CAST(countryId as VARCHAR)
FROM countries_regions where countries_regions.regionId = regions.id
FOR XML PATH('')), 2, 20000) AS CSV, regions.id
FROM countries_regions
inner join regions ON countries_regions.regionId = regions.id
@bojanbjelic
bojanbjelic / htmlEncode.js
Created July 28, 2013 23:03
JavaScript HTML encode
document.createElement('b').appendChild(document.createTextNode('&<>')).parentNode.innerHTML