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
#!/bin/bash | |
HOME="http://www.yourdomain.com/some/page" | |
DOMAINS="yourdomain.com" | |
DEPTH=2 | |
OUTPUT="./urls.csv" | |
wget -r --spider --delete-after --force-html -D "$DOMAINS" -l $DEPTH "$HOME" 2>&1 \ | |
| grep '^--' | awk '{ print $3 }' | grep -v '\. \(css\|js\|png\|gif\|jpg\)$' | sort | uniq > $OUTPUT |
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
@Configuration | |
public class SnakeCaseApplicationConfiguration { | |
@Bean | |
public OncePerRequestFilter snakeCaseConverterFilter() { | |
return new OncePerRequestFilter() { | |
@Override | |
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { | |
final Map<String, String[]> parameters = new ConcurrentHashMap<>(); | |
for (String param : request.getParameterMap().keySet()) { |
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
/** | |
* Adds support for application/octet-stream through a RestController using streams. | |
*/ | |
@Configuration | |
class WebConfig extends WebMvcConfigurationSupport { | |
@Override | |
protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) { | |
converters.add(new AbstractHttpMessageConverter<InputStream>(MediaType.APPLICATION_OCTET_STREAM) { | |
protected boolean supports(Class<?> clazz) { | |
return InputStream.isAssignableFrom(clazz) |
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
package com.andyhawkes.gists; | |
import org.eclipse.swt.graphics.Image; | |
import org.eclipse.swt.graphics.ImageData; | |
import org.eclipse.swt.graphics.Rectangle; | |
import org.eclipse.swt.widgets.Display; | |
/** | |
* Simple class that demonstrates how to slice up regions of a sprite image in SWT, while preserving | |
* alpha transparency. There are shorter ways to do this if you don't care about alpha transparency. |
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
// This is a contrived example of some of the things you can do in a Loadster code step. | |
// HTTP and Wait methods are synchronous by design, no callbacks required. | |
// More documentation is coming soon! | |
console.log("We're in a code step."); | |
// Wait between 0 and 2 seconds | |
user.wait(Math.random() * 2000); | |
// Make a GET request with page resources |
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
var columns = 200; | |
var ticker = document.getElementById("ticker"); | |
for (var i = 0; i < columns; i++) { | |
addTickerColumn(); | |
} | |
function addTickerColumn() { | |
var value = Math.floor(Math.random() * 5); | |
var column = document.createElement("div"); |
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
RewriteEngine on | |
# Automatically rewrite /something -> something.html | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d | |
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.html -f | |
RewriteRule /(.*)$ /$1.html [L] | |
# Strip off .html extensions from the request and redirect | |
RewriteCond %{REQUEST_URI} ^(.+)\.html$ | |
RewriteRule /(.*)\.html$ /$1 [R=301,L] |
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
; .editorconfig | |
root = true | |
[**.js] | |
indent_style = space | |
indent_size = 4 | |
[**.css] | |
indent_style = space |
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
" Vundle package manager | |
set nocompatible " be iMproved | |
filetype off " required! | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
" Vundle packages | |
Bundle 'gmarik/vundle' | |
Bundle 'maksimr/vim-jsbeautify' | |
Bundle 'einars/js-beautify' |
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
public static void disableFullScreen(Shell shell) { | |
try { | |
Field windowField = Shell.class.getDeclaredField("window"); | |
windowField.setAccessible(true); | |
Object window = windowField.get(shell); | |
invoke(window.getClass(), window, "setCollectionBehavior", new Long[] { 0L }); | |
} catch (Exception e) { | |
log.error("couldn't disable full screen mode", e); | |
} |
NewerOlder