Skip to content

Instantly share code, notes, and snippets.

View theredhead's full-sized avatar

Kris theredhead

View GitHub Profile
@import <Foundation/CPObject.j>
@import <Foundation/CPAttributedString.j>
var _regexColors;
@implementation ColorizingTextView : KVOCPText
{
}
@noelboss
noelboss / git-deployment.md
Last active September 4, 2024 16:25
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@TheRayTracer
TheRayTracer / SSD1331.py
Last active March 12, 2020 13:18
The below Python source files control an OLED display (size 96 x 64, 65K colours) using a SSD1331 chipset and the SPI interface. The source code initialises the chipset and includes hardware accelerated functions for drawing primitive shapes and a non-hardware accelerated full ASCII set. Examples include a basic Space Invaders game, and a clock.
import struct
import spidev
import sys
import time
import random
import RPi.GPIO as gpio
ascii = [
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
[ 0x55, 0x00, 0x55, 0x00, 0x55 ],
@paulirish
paulirish / what-forces-layout.md
Last active September 23, 2024 11:37
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@hinzundcode
hinzundcode / gist:2ca9b9a425b8ed0d9ec4
Created May 29, 2015 14:00
NSImage to base64 encoded data url
var path: NSString = NSWorkspace.sharedWorkspace().absolutePathForAppBundleWithIdentifier("com.apple.dt.xcode")!
var icon: NSImage = NSWorkspace.sharedWorkspace().iconForFile(path)
var data: NSData = icon.TIFFRepresentation!
var bitmap: NSBitmapImageRep = NSBitmapImageRep(data: data)!
data = bitmap.representationUsingType(NSBitmapImageFileType.NSPNGFileType, properties: [:])!
var base64: NSString = "data:image/png;base64," + data.base64EncodedStringWithOptions(NSDataBase64EncodingOptions.allZeros)
println(base64)
@labaneilers
labaneilers / ASPNET-MVC-OSX-Apache.md
Last active April 14, 2024 23:20
Setting up ASP.NET MVC 5 via Mono on Mac OSX, with Apache

Install ASP.NET MVC 5 on Mono, Mac OSX, apache with mod_mono

Install mono MDK

  • NOTE: no x64 package is available (unless you want to install from source), so I installed the x86 version

  • Install mono MDK from:

http://www.mono-project.com/download/

I used 3.10.0, which corresponds to .NET 4.5

@ziadoz
ziadoz / awesome-php.md
Last active July 13, 2024 05:29
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@eliaskg
eliaskg / gist:879431
Created March 21, 2011 13:13
Button theming in Cappuccino
@implementation CPButton (MyCostumButton)
- (void)setCustomTheme
{
var normalColorNormal = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:[
[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:"controls/buttonNormalNormalLeft.png"] size:CGSizeMake(2, 24)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:"controls/buttonNormalNormalMiddle.png"] size:CGSizeMake(1, 24)],
[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] pathForResource:"controls/buttonNormalNormalRight.png"] size:CGSizeMake(2, 24)]
] isVertical:NO]];
/*
* CPPropertyAnimation.j
* AppKit
*
* Created by Nicholas Small.
* Copyright 2008, Nicholas Small.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either