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
<?php | |
function gfm($text){ | |
# Extract pre blocks | |
$extractions = array(); | |
$text = preg_replace_callback('/<pre>.*?<\/pre>/s', function($matches) use (&$extractions){ | |
$match = $matches[0]; | |
$md5 = md5($match); | |
$extractions[$md5] = $match; |
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
server { | |
listen 443 ssl; | |
server_name ~^(www\.)?(?<domain>.+)$; | |
# It's possible to configure Nginx to serve static files directly, and | |
# bypassing Apache but I won't describe that here. | |
root /var/apps/$domain/current/public; | |
ssl_certificate /etc/ssl/certs/cmpgns/STAR_cmpgns_nl.crt; | |
ssl_certificate_key /etc/ssl/private/STAR_cmpgns_nl.key; |
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
# Gets the basename of the original request | |
map $request_uri $request_basename { | |
~/(?<captured_request_basename>[^/?]*)(?:\?|$) $captured_request_basename; | |
} | |
# Gets the basename of the current uri | |
map $uri $basename { | |
~/(?<captured_basename>[^/]*)$ $captured_basename; | |
} |
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
<!-- IPAD 3 --> | |
<link rel="stylesheet" href="/stylesheets/ipad3.css" type="text/css" | |
media="only screen and (min-device-width:768px) and (max-device-width:1024px) and (-webkit-min-device-pixel-ratio:1.5)" /> | |
<!-- IPAD 2 --> | |
<link rel="stylesheet" href="/stylesheets/ipad2.css" type="text/css" | |
media="only screen and (min-device-width:768px) and (max-device-width:1024px) and (-webkit-max-device-pixel-ratio:1.5)" /> | |
<!-- IPAD --> | |
<link rel="stylesheet" href="/stylesheets/ipad.css" type="text/css" | |
media="only screen and (min-device-width:768px) and (max-device-width:1024px)" /> | |
<!-- IPHONE 4 --> |
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
set :user, "deploy" | |
set :runner, "deploy" | |
set :application, "example.com" | |
set :deploy_to, "/var/apps/#{application}" | |
set :shared_children, %w(sockets) | |
set :scm, :git | |
set :repository, "[email protected]:example.git" | |
set :deploy_via, :remote_cache |
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
# List the files you need to rename you could run the following from the root of the project: | |
find . -name 'user*' | awk '{print $0; gsub(/user/, "system_user"); print $0}' | xargs -n2 echo "mv" | |
# actually move the files: | |
find . -name 'user*' | awk '{print $0; gsub(/user/, "system_user"); print $0}' | xargs -n2 mv |
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
/** | |
* Automatically open external links in new window | |
*/ | |
(function($){ | |
$(function(){ | |
$('a[href^="http://"],a[href^="https://"]').filter(function() { | |
return this.hostname && this.hostname !== location.hostname; | |
}).attr('target', '_blank'); | |
}); | |
}).call(this, jQuery); |
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
/** | |
* | |
* Basic view manager | |
* | |
* var viewManager = new ViewManager({ | |
* container: '#container' | |
* }); | |
* | |
**/ |
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
select.form-control + .chosen-container.chosen-container-single .chosen-single { | |
display: block; | |
width: 100%; | |
height: 34px; | |
padding: 6px 12px; | |
font-size: 14px; | |
line-height: 1.428571429; | |
color: #555; | |
vertical-align: middle; | |
background-color: #fff; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
OlderNewer