Instantly share code, notes, and snippets.

View Lenovo G510 High Sierra


  • WIFI
  • Ethernet
  • Display
  • Touchpad
  • USB (2 & 3)
  • HDMI (Video works, haven't bothered to fix audio yet)
  • Sleep
  • Audio (No microphone)
View OptionSet.swift
struct Traits: OptionSet {
var rawValue: Int = 0
init(rawValue: Int) {
self.rawValue = rawValue
View MOJavaScriptObject.m
@import JavaScriptCore;
/// Retaining MOJavaScriptObject retains your JSContext/JSObject as well
@interface MOJavaScriptObject : NSObject
@property (readonly) JSObjectRef JSObject;
@property (readonly) JSContextRef JSContext;
View accept-all-suggestions.js
function run(){
var shouldRun = confirm("Are you sure you want to accept all suggestions?\n\n(Note: Depending on the number of suggestions you have, this script may take a few seconds to run.)");
if(!shouldRun) return false;
var events = [ "mouseover", "mousedown", "click", "mouseup" ];
var suggestionButtons = Array.from(document.querySelectorAll("[role='button'][aria-label='Accept suggestion']"));
suggestionButtons.forEach((el) => {
events.forEach((eventName, i) => {
View get-unique-user-styling.js
var getDefaultStyling = function(tagName){
if(!tagName) tagName = "dummy-tag-name";
// Create dummy iframe
var iframe = document.createElement("iframe");
// Create element within the iframe's document
View shape-layer-to-marquee.js
var document = context.document;
// Find first bitmap and shape in selection
var bitmapLayer = document.selectedLayersOfClass(MSBitmapLayer)[0];
if(!bitmapLayer) return;
var shapeLayer = document.selectedLayersOfClass(MSShapeGroup)[0];
View export.js
var size = [MSExportSize sizeWithScale:4 name:"@4x" format:@"png"];
var exportRequests = [MSSliceMaker slicesFromExportableLayer:selection sizes:[ size ]];
[[MSSliceExporter new] exportSlices:exportRequests];
View Resizer.cocoascript.js
var original = context.selection.firstObject();
var originalArtboard = original.parentArtboard();
var artboards = context.document.artboards();
var enumerator = artboards.objectEnumerator();
var artboard;
while((artboard = enumerator.nextObject())){
if(artboard.isEqual_(originalArtboard)) continue;
View NSFetchedResultsController+UICollectionView.m
@interface YourNSFetchedResultsControllerDelegate () <NSFetchedResultsControllerDelegate>
@implementation YourNSFetchedResultsControllerDelegate {
UICollectionView *_collectionView;
NSMutableArray *_collectionViewUpdatesQueue;
View G510 Yosemite