Skip to content

Instantly share code, notes, and snippets.

@schmiddim
schmiddim / GoogleCloudMessagingHandler.php
Last active December 18, 2015 08:39
Google Cloud Messaging(GCM) Serverside example
<?php
class GoogleCloudMessagingHandler{
protected $apiKey;
protected $ids=array();
protected $url= 'https://android.googleapis.com/gcm/send';
public function __construct($apiKey){
$this->apiKey = $apiKey;
$this->fetchIds();
CREATE TABLE IF NOT EXISTS `android_registered_ids` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`registrationID` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=16 ;
package de.schmitt.michael.lebensmittelwarnung.de;
import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
@schmiddim
schmiddim / listview.xml
Created June 11, 2013 13:09
Padding in Listview
<ListView android:id="@+id/MyListView"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:divider="@android:color/transparent"
android:dividerHeight="10.0sp"/>
<?php
public function testGetMax52Weeks() {
$d = new DateTime('2015-08-01 00:00:00');
$date52WeeksAgo = $d->modify('-52 weeks');
var_dump($date52WeeksAgo->format(DateTime::ISO8601));
$dates =[];
$dates[] = '2014-08-01 00:00:00';
@schmiddim
schmiddim / zend2book-get-all-examples
Last active March 1, 2016 15:26
Download all examples for the zend2 Book from Ralf Eggert
#!/bin/bash
wd=$(pwd)
git clone [email protected]:ZF2Buch2/kapitel02.git
git clone [email protected]:ZF2Buch2/kapitel03.git
git clone [email protected]:ZF2Buch2/kapitel04.git
@schmiddim
schmiddim / composer-autoloader.php
Created June 18, 2016 17:10
initialize composer Raw
<?php
// Requiring composer autoloader (local or global)
foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php'] as $file) {
if (file_exists($file)) {
define('COMPOSER_AUTOLOADER', $file);
break;
}
}
@schmiddim
schmiddim / cunt.js
Created August 3, 2016 18:33
Grunt
// Grunt tasks
module.exports = function (grunt) {
"use strict";
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
banner: '/*!\n' +
@schmiddim
schmiddim / user.php
Created September 28, 2017 12:35
Create wordpress user on commandline
<?php
/**
* @author: michael schmitt
* @desc: copy file to the / of a wordpress instance
* execute on commandline: php user.php username + password
*/
if($argc < 3) {
die("usage php user.php username password" .PHP_EOL);
}
$userName= $argv[1];
@schmiddim
schmiddim / ttrss.conf
Created January 12, 2020 15:52
Tiny Tiny Rss nginx config php7.3
#will improve this later
server {
listen 80; ## listen for ipv4; this line is default and implied
root /var/www/stock-rss.vapesetups.com/;
index index.html index.htm index.php;
access_log /var/log/nginx/ttrss_access.log;
error_log /var/log/nginx/ttrss_error.log info;