private void addShortcut(){
Intent shortcut = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
// Shortcut name
shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
shortcut.putExtra("duplicate", false); // Just create once
This file contains hidden or 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
HttpClient httpClient = new DefaultHttpClient(); | |
HttpHead req = new HttpHead("http://xxxxx/_now"); | |
HttpResponse res = httpClient.execute(req); | |
Header header = res.getFirstHeader("x-now"); | |
String value = header.getValue(); | |
Long time = Long.parseLong(value) * 1000l; | |
Date now = new Date(time); |
This file contains hidden or 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 will not work, wierd duplicates: | |
def mailbox_sidebar(&block) | |
content_tag :div, class: 'col-lg-3' do | |
content_tag :div, class: 'ibox float-e-margins' do | |
content_tag :div, class: 'ibox-content mailbox-content' do | |
content_tag :div, class: 'file-manager' do | |
concat yield | |
concat content_tag(:div, '', class: 'clearfix') | |
end |
This file contains hidden or 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
# https://github.com/qbart/database_cleaner | |
RSpec.configure do |config| | |
# ... | |
neo_file = Rails.root.join('config', 'neo4j.yml') | |
connection = YAML.load(IO.read(neo_file))[Rails.env].symbolize_keys | |
DatabaseCleaner[ | |
:neo4j, | |
connection: { type: :server_db, path: connection[:url] } | |
].strategy = :truncation |
This file contains hidden or 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
class Neo | |
def self.query(*cypher) | |
session.query(*cypher) | |
end | |
def self.transaction | |
tx = Neo4j::ActiveBase.new_transaction | |
yield tx | |
rescue => e |
This file contains hidden or 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
Packages: | |
CMake tools | |
Code alignment | |
Hide Main menu | |
Ctrl + K, Ctrl + C / Ctrl + K, Ctrl + U - comment uncomment | |
F12 - go to definition | |
Alt + F12 - preview definition | |
Ctrl + K, Ctrl + F - format code | |
Ctrl + Shift + Space = hint function params |
This file contains hidden or 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 java.text.SimpleDateFormat; | |
import java.text.ParsePosition; | |
import java.util.Date; | |
import java.time.Instant; | |
import static java.lang.System.out; | |
public class ParseTest { | |
public static void main(String[] args) | |
{ |
apt install libcurl4-openssl-dev gdebi-core wget build-essential wget curl libssl-dev git-core nmap openssl libnss3-dev libxml2 libxml2-dev libxslt1-dev zlib1g zlib1g-dev libssl-dev libreadline7 libreadline-dev libreadline6-dev libncurses5 libncurses5-dev cpu-checker vim htop imagemagick libmagick++6 libmagick++-dev libmagickcore-dev libmagickwand-dev ca-certificates apt-transport-https software-properties-common tmux libpq-dev inotify-tools silversearcher-ag
apt install postgresql-client docker.io
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
OlderNewer