View gist:08b7a8c25503003fcb68
1 2 3 4 5 6 7 8 9 10
private boolean isPackageEnabled(String packageName, Context context) {
PackageManager pm = context.getPackageManager();
try {
//ApplicationInfo ai = pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES).applicationInfo;
ApplicationInfo ai = pm.getApplicationInfo(packageName, PackageManager.GET_ACTIVITIES);
return ai.enabled;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
View molo2midi.js
1 2 3 4 5 6 7 8 9 10
// ES6
 
/*
moloch sessions.csv field names
[ 'Protocol',
' First Packet',
' Last Packet',
' Source IP',
View gist:ac861d2ce818179e953b

apache-hive-1.1.0-src/metastore/if/hive_metastore.thrift このThriftファイル内の以下の定義に対して--gen goではErrorとなる。

// this object holds all the information about skewed table
struct SkewedInfo {
  1: list<string> skewedColNames, // skewed column names
  2: list<list<string>> skewedColValues, //skewed values
  3: map<list<string>, string> skewedColValueLocationMaps, //skewed value to location mappings
}
View prismic-asHtml.rb
1 2 3
resolver = Prismic.link_resolver('master'){ |doc_link| "http:#localhost/#{doc_link.id}" }
doc = response.results[0]
html = doc['blog-post.body'].as_html(resolver)
View prismic-htmlSerializer.rb
1 2 3 4 5 6 7 8 9 10
resolver = Prismic.link_resolver('master'){ |doc_link| "http:#localhost/#{doc_link.id}" }
serializer = Prismic.html_serializer do |element, html|
if element.is_a?(Prismic::Fragments::StructuredText::Block::Image)
# Don't wrap images in a <p> tag
%(<img src="#{element.url}" alt="#{element.alt}" width="#{element.width}" height="#{element.height}" />)
else
nil
end
end
doc = response.results[0]
View prismic-cache.rb
1 2 3 4 5
# You can pass any object implementing the same methods as the BasicCache
# https://github.com/prismicio/ruby-kit/blob/master/lib/prismic/cache/basic.rb
cache = Prismic::BasicCache.new
api = Prismic::api('https://lesbonneschoses.cdn.prismic.io/api', { :cache => cache })
# The Api will use the custom cache object
View prismic-images.rb
1 2 3 4
# Accessing image fields
image = doc.get_image('product.image')
# Most of the time you will be using the "main" view
url = image.main.url
View prismic-geopoint.rb
1 2 3 4 5 6
# "near" predicate for GeoPoint fragments
near = Predicates::near('my.store.location', 48.8768767, 2.3338802, 10)
 
# Accessing GeoPoint fragments
place = document.get_geopoint('article.location')
coordinates = place ? (place.latitude.to_s + ',' + place.longitude.to_s) : ''
View prismic-color.rb
1 2
bgcolor = document.get_color('article.background')
hex = '#' + (bgcolor ? bgcolor.value : 'FFFFFF')
Something went wrong with that request. Please try again.