Skip to content

Instantly share code, notes, and snippets.

View liweiyap's full-sized avatar
🌹
Roses are red, violets are blue. Segmentation fault on line 32.

Li-Wei Yap liweiyap

🌹
Roses are red, violets are blue. Segmentation fault on line 32.
View GitHub Profile
@gdamjan
gdamjan / count-github-commits.py
Created September 25, 2011 20:18
A python script to count commits in all of your own repositories on github (not cheking branches)
#! /usr/bin/env python2
import json
import requests
def count_user_commits(user):
r = requests.get('https://api.github.com/users/%s/repos' % user)
repos = json.loads(r.content)
for repo in repos:
@venator85
venator85 / CheckableImageView.java
Created July 19, 2013 13:48
CheckableImageView
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.CompoundButton;
import android.widget.ImageView;
public class CheckableImageView extends ImageView implements Checkable {
#include <android/log.h>
class androidbuf: public std::streambuf {
public:
enum { bufsize = 128 }; // ... or some other suitable buffer size
androidbuf() { this->setp(buffer, buffer + bufsize - 1); }
private:
int overflow(int c) {
if (c == traits_type::eof()) {
*this->pptr() = traits_type::to_char_type(c);
@rxaviers
rxaviers / gist:7360908
Last active July 8, 2024 11:25
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@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
anonymous
anonymous / gist:3b25e358e87334292ce5
Created June 18, 2015 16:03
Swipe Dismiss
import android.animation.ObjectAnimator;
import android.graphics.Rect;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@quellish
quellish / FBClasses.txt
Created August 15, 2015 01:50
Facebook iOS App Class List
headers:
_ASAsyncTransaction.h
_ASAsyncTransactionGroup.h
_ASDisabledPanUITextView.h
_ASDisplayLayer.h
_ASDisplayLayerDelegate-Protocol.h
_ASDisplayView.h
_ASImageNodeDrawParameters.h
_ASPendingState.h
_ASTextNodeCachedMetrics.h
@lopspower
lopspower / README.md
Last active July 5, 2024 10:20
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@anthonygclark
anthonygclark / variant_queue.cc
Created May 2, 2017 22:28
std::queue with boost::variant and dispatch type handling
#include <iostream>
#include <queue>
#include <boost/variant.hpp>
struct message_tag {
bool handled = false;
message_tag() = default;
message_tag(std::nullptr_t) { }
};
@mbinna
mbinna / effective_modern_cmake.md
Last active July 6, 2024 03:59
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft