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 'savon' | |
categories = [] | |
def process(categories, category) | |
categories << {:id => get_category_value(category, 'category_id'), | |
:name => get_category_value(category, 'name')} | |
children = get_category_value(category, 'children') | |
return if children.nil? or children[:item].nil? | |
childrenItem = children[: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
#!/usr/bin/env ruby | |
require 'optparse' | |
require 'fssm' | |
require 'rbconfig' | |
THIS_FILE = File.expand_path(__FILE__) | |
RUBY = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']) |
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 SampleApp | |
class ActivePageTag < Liquid::Tag | |
def initialize(tag_name, text, tokens) | |
super | |
@text = text | |
end | |
def render(context) | |
name = context.environments.first["page"]["name"] | |
return '' if name.nil? or @text.nil? |
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
angular.module('controllers', ['services']) | |
.controller('MyCtrl', ['$scope', ($scope) -> | |
$scope.$watch('dataReady', (ready) -> | |
init() if ready | |
) | |
init = () -> | |
console.log('Init') | |
]) |
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
sudo mysqldump --databases world --single-transaction --compress --order-by-primary –u <local_user> -p<local_password> | |
| mysql --host hostname –-port 3306 –u <RDS_user_name> –p<RDS_password> |
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
$(element[0]).find('input[type=text]'); |
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
free -m && sync && echo 3 > /proc/sys/vm/drop_caches && free -m | |
Flush daily using crontab: | |
0 0 * * * sudo free -m && sync && echo 3 > /proc/sys/vm/drop_caches && free -m |
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 String getRandomString(String prefix) { | |
return prefix + "_" + UUID.randomUUID().toString().replaceAll("-", ""); | |
} |
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
private void createIndex() { | |
boolean indexExists = client.admin().indices().prepareExists(INDEX_NAME).execute().actionGet().isExists(); | |
if (!indexExists) { | |
if (LOGGER.isInfoEnabled()) { | |
LOGGER.info("Index {} doesn't exist, create it now.", INDEX_NAME); | |
} | |
client.admin().indices().prepareCreate(INDEX_NAME).execute(); | |
} | |
} |
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
body { | |
font-family: "Helvetica Neue",Helvetica,"Hiragino Sans GB","Microsoft YaHei","微软雅黑",Arial,sans-serif; | |
} |
OlderNewer