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
exports.query = function(query) { | |
var operator = {}; | |
if (query) { | |
var tokenize = function(operator, str) { | |
var data = str.split(operator); | |
if (data.length > 1) { | |
return data; | |
} | |
return null; |
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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
clean: ['static/assets/user/bare'], | |
jshint: { | |
files: ['Gruntfile.js', 'static/assets/user/js/**/*.js'], | |
options: { | |
globals: { |
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
Func<List<int>, ListItem[]> GetListItems = (items) => | |
{ | |
List<ListItem> list = new List<ListItem>(); | |
foreach(int i in items) | |
{ | |
string item = i.ToString("D2"); | |
list.Add(new ListItem() | |
{ | |
Text = item, | |
Value = item |
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
// http://en.wikipedia.org/wiki/XOR_swap_algorithm | |
private void Swap(ref int x, ref int y) | |
{ | |
x ^= y; | |
y ^= x; | |
x ^= y; | |
} |
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
30 1 * * * root /usr/bin/rdate -s time.bora.net && /sbin/clock -w |
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 -*- | |
import sys | |
import smtplib | |
import datetime | |
from optparse import OptionParser | |
from smtplib import SMTP as SMTP |
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/sh | |
REPOS="$1" | |
REV="$2" | |
#mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf | |
MESSAGE=$(svnlook propget --revprop -r $REV $REPOS svn:log) | |
cat <<EOF | /root/monitor/sendmail.py -s "[COMMIT] $REPOS:$REV" -r user@domain | |
REPOS: $REPOS |
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 class Palindrome { | |
public static void main(String[] args) { | |
System.out.println(isPalindrome("amor roma")); | |
System.out.println(isPalindrome("Was it a car or a cat I saw?")); | |
} | |
public static Boolean isPalindrome(String text) { | |
StringBuilder builder = new StringBuilder(); | |
for (char c : text.toCharArray()) { |
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 class IsSorted { | |
public static void main(String[] args) { | |
System.out.println(isSorted(new int[] { 1, 2, 3, 4 })); // true | |
System.out.println(isSorted(new int[] { 1, 2, 3, 0 })); // false | |
} | |
public static boolean isSorted(int[] items) { | |
for (int i = 0; i < items.length - 1; ++i) { | |
if (items[i] > items[i + 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
// reference: http://en.wikipedia.org/wiki/Soundex | |
public class SoundexUtil { | |
// public static void main(String[] args) { | |
// System.out.println(soundex("Gauss")); // G200 | |
// System.out.println(soundex("AHN")); // A500 | |
// } | |
public static String soundex(String text) { | |
StringBuilder builder = new StringBuilder(); |
OlderNewer