Skip to content

Instantly share code, notes, and snippets.

Avatar

Shane Cowherd shanecowherd

View GitHub Profile
@rcarmo
rcarmo / bt-agent.service
Last active Jun 20, 2020
Set up PAN networking on Raspbian Stretch (use sudo to create these files and run all commands)
View bt-agent.service
# in /etc/systemd/system
[Unit]
Description=Bluetooth Agent
[Service]
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Type=simple
[Install]
WantedBy=multi-user.target
@dantaex
dantaex / save-and-restore-contenteditable-selection.js
Last active Nov 30, 2020
Save and Restore DOM text selection
View save-and-restore-contenteditable-selection.js
function saveSelection() {
if (window.getSelection) {
var sel = window.getSelection();
if (sel.getRangeAt && sel.rangeCount) {
return sel.getRangeAt(0);
}
} else if (document.selection && document.selection.createRange) {
return document.selection.createRange();
}
return null;
@gblancogarcia
gblancogarcia / CircleNode.swift
Created Jan 3, 2016
SpriteKit: creating a resizable circle with a ripple effect animation
View CircleNode.swift
import SpriteKit
class CircleNode: SKShapeNode {
var radius: CGFloat {
didSet {
self.path = CircleNode.path(self.radius)
}
}
View multilinesegmentedcontrol.swift
extension UISegmentedControl
{
func makeMultiline(numberOfLines: Int)
{
for segment in self.subviews
{
let labels = segment.subviews.filter { $0 is UILabel } // [AnyObject]
labels.map { ($0 as UILabel).numberOfLines = numberOfLines }
}
}
@iamjason
iamjason / UIImage+Tinting.swift
Last active Dec 10, 2019
Swift UIImage extension for tinting images
View UIImage+Tinting.swift
/**
Usage:
let originalImage = UIImage(named: "cat")
let tintedImage = originalImage.tintWithColor(UIColor(red: 0.9, green: 0.7, blue: 0.4, alpha: 1.0))
*/
extension UIImage {
func tintWithColor(color:UIColor)->UIImage {
@eternalstorms
eternalstorms / Apple Evangelists.txt
Created Jun 12, 2013
Apple Evangelists (WWDC 2013)
View Apple Evangelists.txt
UI- and App Frameworks Evangelist - Jake Behrens, behrens@apple.com, twitter: @Behrens
- What's new in Cocoa
- Accessibility in iOS
- Building User Interfaces for iOS 7
- Getting Started with UIKit Dynamics
- What's new in Cocoa Touch
- What's New With Multitasking
- Best Practices for Cocoa Animation
- Improving Power Efficiency with App Nap
- Introducing Text Kit
View capture_raw_frames.c
/*
* V4L2 video capture example
*
* This program can be used and distributed without restrictions.
*
* This program is provided with the V4L2 API
* see http://linuxtv.org/docs.php for more information
*/
#include <stdio.h>
You can’t perform that action at this time.