This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Image MakeSquareImage(Image source, int targetLength) | |
{ | |
var sourceBitmap = new Bitmap(source); | |
var sourceLength = Math.Min(source.Size.Height, source.Size.Width); | |
var cropRect = new Rectangle((source.Size.Width - sourceLength)/2, (source.Size.Height - sourceLength)/2, sourceLength, sourceLength); | |
var squaredSource = sourceBitmap.Clone(cropRect, sourceBitmap.PixelFormat); | |
var result = new Bitmap(squaredSource, new Size(targetLength, targetLength)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
var radius = 4; | |
var replacementForHiddenContent = "<li><a>...</a></li>"; | |
var $pages = $(".js-page"); | |
var $activePage = $pages.filter(".active"); | |
var indexOfActive = $pages.index($activePage); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find . -maxdepth 1 -type f -exec xmllint --format -o formatted/{} {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_((\w)([^_]*)) | |
\U$2\L$3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install the Compression/DynamicConmpression role with the Server Manager. | |
Check the httpCompression/dynamicTypes/dynamicTypes element in %windir%\System32\inetsrv\config\applicationhost.config, if application/json is missing, do the following: | |
%windir%\system32\inetsrv\appcmd set config /section:urlCompression /doDynamicCompression:True /commit:apphost | |
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/httpCompression /+"dynamicTypes.[mimeType='application/json; charset=utf-8',enabled='True']" /commit:apphost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "MyScene.h" | |
@interface MyScene () <SKPhysicsContactDelegate> | |
@end | |
@implementation MyScene { | |
NSMutableSet *_notCrashedPhysicsBodies; | |
} | |
static const uint32_t carCategory = 0x1 << 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@interface XOp : NSOperation | |
- (void)finish; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ArrayChunker<T> | |
{ | |
public static T[][] Chunk(T[] sourceArray, int chunkLength) | |
{ | |
var numberOfFullBuffers = sourceArray.Length/chunkLength; | |
var lengthOfRemainderBuffer = sourceArray.Length%chunkLength; | |
var hasRemander = lengthOfRemainderBuffer > 0; | |
var numberOfBuffers = numberOfFullBuffers +( hasRemander ? 1 : 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.filtered = function (options) { | |
var roots = this; | |
var displayProperty = $(roots).first().css('display'); | |
var elementContentArrays = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/xcrun swift | |
import Cocoa | |
import AppKit | |
import CoreGraphics | |
class Spec { | |
let pointSize: Int; | |
let scales: [Int] | |