Skip to content

Instantly share code, notes, and snippets.

Bojan Bjelić bojanbjelic

Block or report user

Report or block bojanbjelic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bojanbjelic
bojanbjelic / ToStringViaReflection.cs
Last active Dec 29, 2015
generic ToString method to show properties and values using Reflection
View ToStringViaReflection.cs
public override string ToString()
{
var propertiesInfo =
GetType().GetProperties().Where(p => Attribute.IsDefined(p, typeof (DataMemberAttribute)));
StringBuilder str = new StringBuilder();
foreach (var propertyInfo in propertiesInfo)
{
if (str.Length > 0)
str.Append(", ");
@bojanbjelic
bojanbjelic / gist:6955563
Created Oct 12, 2013
reverse unordered list
View gist:6955563
Array.reverse.call(null, $('.rightColumn > ul:nth-child(1) li'))
@bojanbjelic
bojanbjelic / htmlEncode.js
Created Jul 28, 2013
JavaScript HTML encode
View htmlEncode.js
document.createElement('b').appendChild(document.createTextNode('&<>')).parentNode.innerHTML
View csv.sql
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
View NoisyCrossesShapedPixelsGlitch
// 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:
View NoisyCrosses
// 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
View CrossMovement
// 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;
View CrossOfJaggedCircles
// 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;
View SpinningJaggedTargets
// 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;
View BlurredWiggleRectangle
// 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;
You can’t perform that action at this time.