This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The regex patterns in this gist are intended to match any URLs, | |
including "mailto:[email protected]", "x-whatever://foo", etc. For a | |
pattern that attempts only to match web URLs (http, https), see: | |
https://gist.github.com/gruber/8891611 | |
# Single-line version of pattern: | |
(?i)\b((?:[a-z][\w-]+:(?:/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DropboxClient.prototype.putFile = function(file, path, optargs, cb) { | |
if (typeof optargs == 'function') cb = optargs, optargs = {}; | |
var boundary = 'sAxIqse3tPlHqUIUI9ofVlHvtdt3tpaG', | |
content_type = 'multipart/form-data; boundary=' + boundary, | |
self = this; | |
require('fs').readFile(file, function (err, data) { | |
if (err) return cb(err); | |
// Build request body. | |
path = escapePath(path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* mobile UA detection http://jsfiddle.net/Takazudo/rxPYk/ */ | |
var ua = (function(){ | |
var ua = {}; | |
var navigator = window.navigator; | |
var platforms = [ | |
{ property: 'platform', regex: /iPhone/i, identity: 'iPhone' }, | |
{ property: 'platform', regex: /iPod/i, identity: 'iPod' }, | |
{ property: 'userAgent', regex: /iPad/i, identity: 'iPad' }, | |
{ property: 'userAgent', regex: /Blackberry/i, identity: 'Blackberry' }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# xcode noise | |
build/* | |
*.perspective | |
*.perspectivev3 | |
*.pbxuser | |
*.xcworkspace | |
*.mode1 | |
*.mode2v3 | |
*.mode1v3 | |
xcuserdata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you want to clone an svn repository with git-svn but don't want it to push all the existing branches, here's what you should do. | |
* Clone with git-svn using the -T parameter to define your trunk path inside the svnrepo, at the same time instructing it to clone only the trunk: | |
git svn clone -T trunk http://example.com/PROJECT | |
* If instead of cloning trunk you just want to clone a certain branch, do the same thing but change the path given to -T: | |
git svn clone -T branches/somefeature http://example.com/PROJECT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from flask import Flask, render_template | |
app = Flask(__name__) | |
@app.route('/') | |
def index(): | |
return render_template('index.html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules | |
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Global Reset of all HTML Elements | |
* | |
* Resetting all of our HTML Elements ensures a smoother | |
* visual transition between browsers. If you don't believe me, | |
* try temporarily commenting out this block of code, then go | |
* and look at Mozilla versus Safari, both good browsers with | |
* a good implementation of CSS. The thing is, all browser CSS | |
* defaults are different and at the end of the day if visual | |
* consistency is what we're shooting for, then we need to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Node.js, express, oauth example using Twitters API | |
Install Node.js: | |
curl -0 http://nodejs.org/dist/v0.6.11/node-v0.6.11.tar.gz | |
tar -zxf node-v0.6.11.tar.gz | |
cd node-v0.6.11 | |
./configure | |
make | |
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ui-dialog-background { | |
opacity: 0.5; | |
display: block !important; | |
-webkit-transition: opacity 0.5s ease-in; | |
} | |
.ui-dialog-background.pop.in { | |
opacity: 1; | |
-webkit-transition: opacity 0.5s ease-in; | |
} |
OlderNewer