Skip to content

Instantly share code, notes, and snippets.

View medyo's full-sized avatar

Mehdi Sakout medyo

View GitHub Profile
@IhorKlimov
IhorKlimov / Getter Ignore m Prefix
Created February 2, 2017 22:56
Android Studio Getter/Setter Ignore m Prefix Templates
#if($field.modifierStatic)
static ##
#end
$field.type ##
#set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($helper.getPropertyName($field, $project))))
#if ($field.boolean && $field.primitive)
#if ($StringUtil.startsWithIgnoreCase($name, 'is'))
#set($name = $StringUtil.decapitalize($name))
#else
is##
@martintreurnicht
martintreurnicht / ColorUtil
Created November 28, 2014 14:47
Lighten and darken colors in android
public static int lighten(int color, double fraction) {
int red = Color.red(color);
int green = Color.green(color);
int blue = Color.blue(color);
red = lightenColor(red, fraction);
green = lightenColor(green, fraction);
blue = lightenColor(blue, fraction);
int alpha = Color.alpha(color);
return Color.argb(alpha, red, green, blue);
}
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@edelpero
edelpero / heroku_rails_phantomjs.md
Last active May 10, 2021 08:31
Heroku, Ruby on Rails and PhantomJS

#Heroku, Ruby on Rails and PhantomJS

In this post, I’m going to show you how to modify an existing Ruby on Rails app running on Heroku’s Cedar stack to use PhantomJS for screen scraping. If you’ve never heard of PhantomJS, it’s a command-line WebKit-based browser (that supports JavaScript, cookies, etc.).

Let’s get started. This is a high-level overview of the required steps:

  • Modify your app to use multiple Heroku buildpacks.
  • Extend your app to use both the Ruby as well as the PhantomJS buildpacks.
  • Confirm that everything worked.
@MarsVard
MarsVard / README
Last active November 3, 2022 19:19
android drawable to imitate google cards.
put card.xml in your drawables directory, put colors.xml in your values directory or add the colors to your colors.xml file.
set the background of a view to card,
as you can see in card.xml the drawable handles the card margin, so you don't have to add a margin to your view
``` xml
<View
android:layout_width="fill_parent"
@arriolac
arriolac / Android Studio Tricks.md
Last active January 28, 2022 02:40
Some Android Studio Tricks.

Android Studio Notes

Android Studio keyboard shortcuts I use often.

Keyboard Shortcuts for Mac

  • SHIFT + F6 to refactor methods, classes, and variable names
  • CTRL + O to override methods
  • COMMAND + N
    • Generate getter, setter, and constructor method for a class (when in editor pane)
@mdesantis
mdesantis / schedule.rb
Last active May 28, 2023 16:11
Schedule script for using Whenever toghether with rbenv
# Schedule script for using Whenever toghether with rbenv
#
# Whenever: https://github.com/javan/whenever
# rbenv: https://github.com/sstephenson/rbenv
set :env_path, '"$HOME/.rbenv/shims":"$HOME/.rbenv/bin"'
# doesn't need modifications
# job_type :command, ":task :output"
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@klange
klange / _.md
Last active December 2, 2023 20:36
It's a résumé, as a readable and compilable C source file. Since Hacker News got here, this has been updated to be most of my actual résumé. This isn't a serious document, just a concept to annoy people who talk about recruiting and the formats they accept résumés in. It's also relatively representative of my coding style.

Since this is on Hacker News and reddit...

  • No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
  • I apologize for the use of _t in my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries".
  • Since people kept complaining, I've fixed the assignments of string literals to non-const char *s.
  • My use of type * name, however, is entirely intentional.
  • If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le