Skip to content

Instantly share code, notes, and snippets.

@teddyhwang
teddyhwang / gist:4286118
Created December 14, 2012 15:09
129 bytes to enable HTML5 on old browsers
<script>
;("header footer section aside nav article figure figcaption hgroup time").replace(/\w+/g,function(a){document.createElement(a)})
</script>
@elimisteve
elimisteve / build
Last active December 10, 2015 11:29 — forked from mrosset/build
`build`, `start`, and `stop` scripts for getting Go web apps to run on OpenShift. Put these files in the `.openshift/action_hooks/` directory of your app.
#!/bin/bash
# This is a simple build script and will be executed on your CI system if
# available. Otherwise it will execute while your application is stopped
# before the deploy step. This script gets executed directly, so it
# could be python, php, ruby, etc.
tarball="https://go.googlecode.com/files/go1.0.3.linux-amd64.tar.gz"
# Set GOROOT since we don't use GOROOT_FINAL
mkdir -p $OPENSHIFT_HOMEDIR/app-root/data/go
diff --git a/js/util.js b/js/util.js
index c228026..b6a6950 100644
--- a/js/util.js
+++ b/js/util.js
@@ -616,7 +616,9 @@ var SN = { // StatusNet
$('#content .notice_reply').live('click', function(e) {
e.preventDefault();
var notice = $(this).closest('li.notice');
- SN.U.NoticeInlineReplyTrigger(notice);
+ // @fixme: is this the proper way to get the nick?
@tef
tef / python_ruby.py.rb
Last active December 17, 2015 13:29
python/ruby quine. changes comment to indicate what it last ran as.
# Python or Ruby
l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10)),'l,p,q=(""and"# Ruby"+10 .chr or"# Python"+chr(10))','print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q)))'
print((""and"#{print l;c=39.chr;puts p+44.chr+c+p+c+44.chr+c+q+c;puts q}"or"{}{},{!r},{!r}{}{}".format(l,p,p,q,chr(10),q)))
@Zatnosk
Zatnosk / social_web_idea.md
Last active February 26, 2018 08:30
Social web idea

[The following is a chat log from a Slack group]

arturovm

How’s this for a new social network?

  1. There are no likes
  2. There are no followers or “friends”; they’re called contacts
  3. There are no “re-posts”; you can only share someone else’s post with your contacts and add your comment to it (similar to Tiwtter’s quote-tweet), but people can’t reply to your “share”. Your “share” of the post appears under the original post’s replies, and any time someone who saw you share the post would want to discuss it, replies have to be made on the original post.

zatnosk

sounds fancy. I "like" the no-likes part. Would the contact thing be equal to what we currently call "mutuals"? i.e. both parts have to actively seek the connection.

@tebeka
tebeka / .ctags
Created February 1, 2014 17:00
ctags support for Go
--langdef=Go
--langmap=Go:.go
--regex-Go=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/
--regex-Go=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/
--regex-Go=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/
--regex-Go=/([a-zA-Z_][a-zA-Z0-9_]*)[ \t]*:=/\1/d,var/
- (void)loadDefaultSettings
{
NSMutableDictionary *defaults = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default-Settings" ofType:@"plist"]];
// other setup...
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithDictionary:defaults]];
}
- (void)resetDefaultSettings
@zoul
zoul / DownloadOperation.h
Created September 14, 2010 06:36
Asynchronous NSURLConnection in concurrent NSOperation
@interface DownloadOperation : NSOperation
{
NSURLRequest *request;
NSURLConnection *connection;
NSMutableData *receivedData;
}
@property(readonly) BOOL isExecuting;
@property(readonly) BOOL isFinished;

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals

@omz
omz / gist:1102091
Created July 24, 2011 01:40
Creating arbitrarily-colored icons from a black-with-alpha master image (iOS)
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end