Skip to content

Instantly share code, notes, and snippets.

@HendrixString
HendrixString / gradle.md
Created February 11, 2017 20:26
Gradle cheat sheet
  1. download the dependencies of the project ./gradlew assemble
  2. start a java gradle project gradle init --type “java-library"
  3. add the gradle wrapper to the project gradle wrapper --gradle-version 2.0
  4. build ./gradlew build
  5. test ./gradlew test
@HendrixString
HendrixString / fibo.go
Last active February 13, 2017 14:11
Golang Fibonnaci
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
var n, f_n_1, f_n_2 = -1, 1, 1
@HendrixString
HendrixString / bash.md
Last active September 8, 2017 11:09
bash cheat sheet

man - show the doc of a command

man <commnad>

common

. = current directory
~ = home directory
$HOME = home directory
pwd = print current directory
cat <file> = print file content
cat > <file> << EOF = write output stream into a file
export VAR=VALUE = export environment variable

@eveliotc
eveliotc / MyActivityOrFragment.java
Created July 29, 2013 15:38
A variant of https://gist.github.com/eveliotc/6051367 to show a drop shadow, should not be used for performance in mind views
final ImageView imageView = (ImageView) view.findViewById(R.id.image);
final int shadowSize = getResources().getDimensionPixelSize(R.dimen.shadow_size);
final int shadowColor = getResources().getColor(R.color.shadow_color);
imageView.setImageDrawable(new RoundedAvatarDrawable(mBitmap, shadowSize, shadowColor));
if (SDK_INT >= HONEYCOMB) {
imageView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
@HendrixString
HendrixString / git.md
Last active October 23, 2019 15:36
git cheat sheet

account

setup name and email
for a specific repository, navigate into it and type
git config user.name "your username"
git config user.email "foo@bar.com"
note add --global to make it global for new repositories

change your editor for commits
git config --global core.editor "pico"
get the remote repository url

@DTrejo
DTrejo / .gitignore
Created April 4, 2011 03:32
How to Readline - an example and the beginnings of the docs
node_modules/
@EmilHernvall
EmilHernvall / Base64.java
Last active February 24, 2021 06:24
Simple base64-encoder for java
public class Base64
{
public static String encode(byte[] data)
{
char[] tbl = {
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/' };
@prograhammer
prograhammer / git-cheat-sheet.md
Last active March 14, 2023 17:44
Git cheat sheet for some useful Git commands and command scenarios.
@HendrixString
HendrixString / ansi.md
Last active March 26, 2023 14:09
ANSI 256 color codes resources
echo -e "testing \033[48;5;88mCOLOR1\033[38;208;48;5;159mCOLOR2\033[m"

The color range of a 256 color terminal consists of 4 parts, often 5, in which case you actually get 258 colors:

  • Color numbers 0 to 7 are the default terminal colors, the actual RGB value of which is not standardized and can often be configured.
  • Color numbers 8 to 15 are the "bright" colors. Most of the time these are a lighter shade of the color with index - 8. They are also not standardized and can often be configured. Depending on terminal and shell, they are often used instead of or in conjunction with bold font faces.
  • Color numbers 16 to 231 are RGB colors. These 216 colors are defined by 6 values on each of the three RGB axes. That is, instead of values 0 - 255, each color only ranges from 0 - 5.
@jessefreeman
jessefreeman / layers_to_sprite_sheet.js
Created March 15, 2011 01:15
This is a PS script to make Sprite Sheets out of layers. Modified from http://www.garagegames.com/community/blogs/view/11527
// Put this file in Program Files\Adobe\Photoshop\Presets\Scripts\
// In PhotoShop menu File > Automate > Scripts: layersToSprite.js
// Arrange layers into a sprite sheet.
if (documents.length > 0)
{
// --------------------------
docRef = activeDocument;