#define iterate(i, n) for (i = 0; i < n; ++i)
#define print_int_arr(arr, i, n) for (i = 0; i < n; ++i) printf("%d, ", arr[i]);
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
bind -T root F12 \ | |
set prefix None \;\ | |
set key-table off \;\ | |
set status-style "fg=$color_status_text,bg=$color_window_off_status_bg" \;\ | |
set window-status-current-format "#[fg=$color_window_off_status_bg,bg=$color_window_off_status_current_bg]$separator_powerline_right#[default] #I:#W# #[fg=$color_window_off_status_current_bg,bg=$color_window_off_status_bg]$separator_powerline_right#[default]" \;\ | |
set window-status-current-style "fg=$color_dark,bold,bg=$color_window_off_status_current_bg" \;\ | |
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\ | |
refresh-client -S \;\ | |
bind -T off F12 \ |
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
require 'action_view' | |
NOTICE_ATTRIBS = 5 | |
TOP_NOTICES = 5 | |
# https://apidock.com/rails/v4.2.1/ActionView/Helpers/TextHelper/split_paragraphs | |
def split_paragraphs(text) | |
return [] if text.blank? | |
text.to_str.gsub(/\r\n?/, "\n").split(/\n\n+/).map! do |t| |
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
t = [1, 12, 123, 1234, 12345, | |
123456, 1234567, 12345678, | |
123456789, 1234567890, | |
12345678901, 123456789012]; | |
function convert(x) { | |
return x.toString().substr() | |
.replace(/\B(?=\d{3}$)/g, ",") | |
.replace(/\B(?=(\d{2})+(?!\d),)/g, ",") | |
}; |
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
set mouse=a | |
set expandtab | |
set shiftwidth=2 | |
set softtabstop=2 | |
set tw=80 | |
syntax on | |
filetype plugin on |
Location | Variable names | Command to check if this variable still exists |
---|---|---|
~/dotfiles/.local/kgp.zsh |
HTTP_PROXY , HTTPS_PROXY , http_proxy , https_proxy |
`export |
~/.gitconfig |
Git variables for http and https proxies | git config --list |
~/.bowerrc |
proxy and https-proxy used by Gulp |
No command, check the file itself. remove or change variable name in the file |
~/.npmrc |
http-proxy and https-proxy used by NPM |
No command, check the file and remove or change |
/etc/systemd/system/docker.service.d/http-proxy.conf |
Environment used by Docker to pull images |
systemctl show --property=Environment docker => Output should be Environment= (if it shows proxy, then this file needs to be changed) Tutorial |
Operation | Code |
---|---|
New List |
List<Integer> x = new ArrayList<Integer>(); |
Copy List |
List<Integer> x = new ArrayList<Integer>(y); |
Add an element to the List |
x.add(element) |
Get an elemenet from the List |
x.get(index) |
Clear the list | x.clear() |
New HashMap |
HashMap<Integer, String> x = new HashMap<Integer, String>(); |
Add element to the map | x.put(key, value) |
Get an element from the map | x.get(key) |
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
function findZip(dir, callback) { | |
var fs = require('fs'); | |
var fileList = fs.readdirSync(dir); | |
var candidates = []; | |
for(i in fileList) { | |
if (fileList[i].match(/.zip$/)) { | |
candidates.push(fileList[i]); | |
} | |
} | |
if (candidates.length == 1) { |
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
Almost all of the questions posted in this sub are some form of "what do I have to know/do to pass a tech interview/get a job." Here's some distilled advice I can offer from having conducted over 1000 tech interviews. This doesn't cover everything, but I think it covers the most important foundational elements. | |
Setting expectations: If this is your first time looking for a job, or you haven't had to interview in a number of years, expect to invest some effort in preparing for the interview. It's usually the industry professionals that completely ignore this step, but some college students do as well. You're essentially studying for a test, don't slack off - it's going to be work. All of those things that you've been telling yourself don't matter (maybe you're a bit fuzzy on how exactly the internet works - do you really know what happens after you hit enter on the URL bar?) that you don't know - now it's time to address those gaps head on. So, what matter. | |
For the sake of space, I'm going to focus on what a |
You can use this class to realize a simple sectioned grid RecyclerView.Adapter
without changing your code.
The RecyclerView
has to use a GridLayoutManager
.
This is a porting of the class SimpleSectionedListAdapter
provided by Google
If you are looking for a sectioned list RecyclerView.Adapter
you can take a look here
NewerOlder