Skip to content

Instantly share code, notes, and snippets.

View mazurio's full-sized avatar

Damian Mazurkiewicz mazurio

View GitHub Profile
@POST("/announcements")
Announcement insertAnnouncement(
@Body Announcement announcement,
@Query("auth") String authToken
);
public class Announcement implements Serializable {
public String module_id;
public String user_id;
@mazurio
mazurio / PopupMenuHolder
Created February 22, 2014 23:55
Android Popup Menu when using Holders
@Override
public View getView(int p, View convertView, ViewGroup parent)
{
final ViewHolder holder;
if (convertView == null)
{
holder = new ViewHolder();
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.d_item, null);
{
"list": [
{
"author": "George R. R. Martin",
"cover": "http://i.imgur.com/8VmUcJX.jpg",
"id": "book2",
"title": "A Storm of Swords"
},
{
"author": "Stephen G. Kochan",
/////////////////////////////////////////////////////////////////////////
//// MMCSD.c ////
//// ////
//// This is a low-level driver for MMC and SD cards. ////
//// ////
//// --User Functions-- ////
//// ////
//// mmcsd_init(): Initializes the media. ////
//// ////
//// mmcsd_read_byte(a, p) ////
/////////////////////////////////////////////////////////////////////////
//// FAT_PIC.C ////
//// ////
//// Driver/Library for a FAT filesystem with a PIC ////
//// ////
//// This Library was designed to resemble standard ANSI C I/O as ////
//// much as possible. There are, however, some caveats to this. ////
//// Please read the comments to make sure the inputs and outputs ////
//// to each function are understood before using anything in ////
//// this library. ////
#include <18f2420.h>
#device PASS_STRINGS = IN_RAM
#include <18f2420_registers.h>
#fuses INTRC_IO, NOBROWNOUT, NOPROTECT, NOIESO, NOWDT, NOLVP
#use delay(clock=8000000)
#use rs232(baud=7200, xmit=PIN_C6, rcv=PIN_C7, UART1, errors)
@mazurio
mazurio / run.sh
Created February 25, 2015 12:04
Bash Android: Run gradle install flavour and send an intent to every device in order to launch application on all devices.
#!/bin/bash
# Runs gradle task installGoogleDebug and starts MainActivity on each available running device and emulator.
./gradlew installGoogleDebug &&
adb devices | while read line
do
if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
then
device=`echo $line | awk '{print $1}'`
echo "Starting Application on device: $device $@ ..."
adb -s $device shell am start -n io.mazur.project/io.mazur.project.ui.MainActivity
java.lang.IllegalStateException: onMoveItem() - may be a bug or has duplicate IDs --- mDraggingItemInitialPosition = 1, mDraggingItemCurrentPosition = 0, origFromPosition = 0, fromPosition = 1, toPosition = 0
at com.h6ah4i.android.widget.advrecyclerview.draggable.DraggableItemWrapperAdapter.moveItem(DraggableItemWrapperAdapter.java:294)
at com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.swapItems(RecyclerViewDragDropManager.java:684)
at com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.checkItemSwapping(RecyclerViewDragDropManager.java:534)
at com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager.handleScrollOnDragging(RecyclerViewDragDropManager.java:595)
at com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager$ScrollOnDraggingProcessRunnable.run(RecyclerViewDragDropManager.java:827)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:
@mazurio
mazurio / gist:5092dc53bd4a4db956a1
Created April 19, 2015 17:52
Basic SDL2 Template
#include <iostream>
#include <SDL.h>
using namespace std;
int main() {
if(SDL_Init(SDL_INIT_VIDEO) != 0) {
std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
return 1;
@mazurio
mazurio / gist:a9e294c689831dc54a58
Created April 19, 2015 17:53
Basic SDL2 Template for CMAKE
cmake_minimum_required(VERSION 3.0)
include(FindPkgConfig)
project(SDL01)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES main.cpp)
add_executable(SDL01 ${SOURCE_FILES})