Skip to content

Instantly share code, notes, and snippets.

@barbietunnie
barbietunnie / SquawkFirebaseMessageService.java
Created August 8, 2017 01:40
Sample implementation of FirebaseMessagingService that shows a Notification and saves data in Content Provider
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@anggadarkprince
anggadarkprince / AppHelper.java
Last active May 2, 2023 22:39
Upload file with Multipart Request Volley Android
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import java.io.ByteArrayOutputStream;
/**
* Sketch Project Studio
* Created by Angga on 12/04/2016 14.27.
*/
public class AppHelper {
@flesler
flesler / index.html
Last active September 11, 2021 13:16
Anchor navigation powered by jquery.scrollTo
<!-- Include jQuery from somewhere, must use version 1.8 or above -->
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include latest jquery.scrollTo, can download from https://github.com/flesler/jquery.scrollTo/releases -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.scrollto/2.1.2/jquery.scrollTo.min.js"></script>
<!-- Initialize the plugin, the contents of the script can be inlined here, of course -->
<script type="text/javascript" src="js/init.js"></script>
@danielevans
danielevans / gist:2416927
Created April 18, 2012 22:06
A Shim for allowing jQuery UI to handle touch events for sortable/draggable
/*
* Content-Type:text/javascript
*
* A bridge between iPad and iPhone touch events and jquery draggable,
* sortable etc. mouse interactions.
* @author Oleg Slobodskoi
*
* modified by John Hardy to use with any touch device
* fixed breakage caused by jquery.ui so that mouseHandled internal flag is reset
* before each touchStart event
@kinopyo
kinopyo / application_helper.rb
Created March 27, 2012 14:28
Rails: Detect if mobile agent
# from https://github.com/ruby-china/ruby-china/blob/master/app/helpers/application_helper.rb
MOBILE_USER_AGENTS = 'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' +
'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' +
'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' +
'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' +
'webos|amoi|novarra|cdm|alcatel|pocket|iphone|mobileexplorer|mobile'
def mobile?
agent_str = request.user_agent.to_s.downcase
return false if agent_str =~ /ipad/
@MatthewEppelsheimer
MatthewEppelsheimer / country-shortcode.php
Last active February 27, 2023 11:44
WP Contact Form 7 shortcode with list of Countries
<?php
/*
Localizations:
- [Spanish](https://gist.github.com/MatthewEppelsheimer/1498955#gistcomment-3317461) props @chdgp
UPDATED: 2020-03-09
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active September 8, 2023 17:57
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in