Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# SPDX-License-Identifier: MIT
## Copyright (C) 2009 Przemyslaw Pawelczyk <przemoc@gmail.com>
##
## This script is licensed under the terms of the MIT license.
## https://opensource.org/licenses/MIT
#
# Lockable script boilerplate
@MicahElliott
MicahElliott / colortrans.py
Created November 29, 2010 07:57
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@mikeash
mikeash / gist:837409
Created February 21, 2011 17:47
Block-based URL connection
// NSURLConnection wrapper
// like NSURLConnection, requires a runloop, callbacks happen in runloop that set up load
@interface LDURLLoader : NSObject
{
NSURLConnection *_connection;
NSTimeInterval _timeout;
NSTimer *_timeoutTimer;
NSURLResponse *_response;
long long _responseLengthEstimate;
NSMutableData *_accumulatedData;
@rsms
rsms / gist:3564654
Created September 1, 2012 05:33
Life is purposeless. And it is beautiful that it is purposeless

Life is purposeless. And it is beautiful that it is purposeless

It is very difficult, particularly for the Western mind, to understand that life is purposeless. And it is beautiful that it is purposeless. If it is purposeful then the whole thing becomes absurd – then who will decide the purpose? Then some God has to be conceived who decides the purpose, and then human beings become just puppets; then no freedom is possible. And if there is some purpose then life becomes businesslike, it cannot be ecstatic.

The West has been thinking in terms of purpose, but the East has been thinking in terms of purposelessness. The East says life is not a business, it is a play. And a play has no purpose really, it is nonpurposeful. Or you can say play is its own purpose, to play is enough. Life is not reaching towards some goal, life itself is the goal. It is not evolving towards some ultimate; this very moment, here and now, life is ultimate.

Life as it is, is accepted in the East. It is not moving towards some end, b

@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@jamesrampton
jamesrampton / open_without.sh
Last active October 8, 2019 21:16
Clean up Mac OS X Open With menu
#!/bin/bash
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
killall Finder
@mikevansnell
mikevansnell / invite.js
Last active October 22, 2018 21:04
Parse.com cloudcode sample that enables one user to invite another user, and immediately returns the new user object so that you can do something with it (e.g. start associating objects with it).
// in invite.js module:
exports.inviteUser = function(creatingUser,email,tempPass,response)
{
"use strict";
if (!tempPass) {
tempPass = genRandomPass();
}
var user = new Parse.User();
user.set ("username", email);
@capyvara
capyvara / gist:5230032
Last active May 18, 2018 19:25
Process the Unity generated Xcode project to allow dSYM generation on Release but keeping the distribution size the same, only tested in a clean generated project.
// Adjust dSYM generation
var xcodeProjectPath = Path.Combine(xcodeProjectDir, "Unity-iPhone.xcodeproj");
var pbxPath = Path.Combine(xcodeProjectPath, "project.pbxproj");
var sb = new System.Text.StringBuilder();
var xcodeProjectLines = File.ReadAllLines(pbxPath);
foreach (var line in xcodeProjectLines)
{
// Remove from OTHER_LDFLAGS
@steipete
steipete / PSPDFUIKitMainThreadGuard.m
Last active March 10, 2024 19:23
This is a guard that tracks down UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You might n…
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
// You should only use this in debug builds. It doesn't use private API, but I wouldn't ship it.
// PLEASE DUPE rdar://27192338 (https://openradar.appspot.com/27192338) if you would like to see this in UIKit.
#import <objc/runtime.h>
#import <objc/message.h>

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style