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
// Get current URL without the document portion or parameters | |
// For example, if the URL is: | |
// http://hostname:8080/path/to/application/document.html?param1=1¶m2=2 | |
// baseUrl will be: | |
// http://hostname:8080/path/to/application/ | |
var baseUrl = [location.protocol, '//', location.host, location.pathname.split('/').slice(0, -1).join('/'), '/'].join(''); |
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.nileshk; | |
import java.util.function.Function; | |
import java.util.stream.Stream; | |
public class BeanCompareUtil { | |
public static <T> boolean compareBeans(T bean1, T bean2, Function<T, Object>... getters) { | |
return Stream.of(getters).allMatch(getter -> { | |
Object val1 = getter.apply(bean1); |
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
require 'rubygems' | |
require 'sequel' | |
require 'fileutils' | |
module Jekyll | |
module Drupal | |
QUERY = " | |
select n.nid node_id, | |
n.title post_title, |
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
<exec executable="svn" spawn="false" dir="." outputproperty="revision.number"> | |
<arg line="info"/> | |
<redirector> | |
<outputfilterchain> | |
<linecontainsregexp><regexp pattern="^Last\sChanged\sRev:\s[0-9]*$" /></linecontainsregexp> | |
<tokenfilter> | |
<replaceregex pattern="^Last\sChanged\sRev:\s([0-9]*)$" replace="\1" flags="g" /> | |
</tokenfilter> | |
</outputfilterchain> | |
</redirector> |
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
import os | |
print os.walk('.').next()[1] |
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
import os | |
import errno | |
def pid_exists(pid): | |
"""Check whether pid exists in the current process table.""" | |
if pid < 0: | |
return False | |
try: | |
os.kill(pid, 0) | |
except OSError, e: |
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
import urllib2 | |
import base64 | |
def fetch(url, username, password): | |
try: | |
request = urllib2.Request(url) | |
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '') | |
request.add_header("Authorization", "Basic %s" % base64string) | |
return urllib2.urlopen(request).read() | |
except urllib2.HTTPError as ex: |
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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:f="http://java.sun.com/jsf/core" | |
xmlns:h="http://java.sun.com/jsf/html" | |
xmlns:ui="http://java.sun.com/jsf/facelets" | |
xmlns:p="http://primefaces.org/ui" | |
xmlns:c="http://java.sun.com/jsp/jstl/core" | |
xmlns:pe="http://primefaces.org/ui/extensions"> | |
<h:head> |
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 | |
if [[ "$OSTYPE" == "darwin"* ]]; then | |
export DYLD_LIBRARY_PATH=$(dirname $(which sqlplus)) | |
fi | |
# ... rest of your script that calls Oracle sqlplus |
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/python | |
from __future__ import print_function | |
import string | |
import os | |
import sys | |
import re | |
import argparse | |
from subprocess import Popen, PIPE |
OlderNewer