Skip to content

Instantly share code, notes, and snippets.

View pushandplay's full-sized avatar
:octocat:
💻💰

Master of life pushandplay

:octocat:
💻💰
View GitHub Profile
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
#paper_button {
left: 310px;
top: 110px;
position: relative;
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
</template>
<script>
<?php
$applesharedsecret = "XXXXXXXXXXX";
$receiptbytes = $_POST['receiptbytes'];
//$appleurl = "https://buy.itunes.apple.com/verifyReceipt"; // for production
$appleurl = "https://sandbox.itunes.apple.com/verifyReceipt"; // for testing
$request = json_encode(array("receipt-data" => $receiptbytes,"password"=>$applesharedsecret));
$ch = curl_init($appleurl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
@pushandplay
pushandplay / extractiOSVersion
Created November 14, 2014 23:52
Extract iOS Version
(navigator.userAgent).match(/OS\s+([\d\_]+)/i)[0].replace(/_/g, '.').replace('OS ', '')
@pushandplay
pushandplay / randomcolor
Created March 5, 2015 22:16
Random color with JavaScript
"#" + ((1<<24)*Math.random()|0).toString(16)
// 5 columns layout for bootstrap
.col-xs-2_4,
.col-sm-2_4,
.col-md-2_4,
.col-lg-2_4
position: relative
min-height: 1px
padding-right: 10px
padding-left: 10px
@pushandplay
pushandplay / 1.coffee
Created April 21, 2015 10:54
adapter-pattern
# a fragment of 3-rd party grid component
class AwesomeGrid
constructor: (@datasource)->
@sort_order = 'ASC'
@sorter = new NullSorter # in this place we use NullObject pattern (another useful pattern)
setCustomSorter: (@customSorter) ->
@sorter = customSorter
sort: () ->
@datasource = @sorter.sort @datasource, @sort_order
# don't forget to change sort order
<?php
$memory = round(memory_get_usage()/1024/1024, 4).' Mb';
print "<div>Memory: {$memory}</div>";
$totalTime= ($modx->getMicroTime() - $modx->startTime);
$queryTime= $modx->queryTime;
$queryTime= sprintf("%2.4f s", $queryTime);
$queries= isset ($modx->executedQueries) ? $modx->executedQueries : 0;
$totalTime= sprintf("%2.4f s", $totalTime);
<?php
/**
* @package modx
* @subpackage processors.element.tv.renders.mgr.input
*
* core/model/modx/processors/element/tv/renders/mgr/input/gmaps.class.php
*/
class modTemplateVarInputRenderGmaps extends modTemplateVarInputRender {
public function getTemplate() {
return 'element/tv/renders/input/gmaps.tpl';
@pushandplay
pushandplay / gist:5992196
Created July 13, 2013 21:00
FIX for Bootstrap and Google Maps Info window styes problem
# FIX for Bootstrap and Google Maps Info window styes problem
css = document.createElement 'style'
css.type = 'text/css'
styles = 'img[src*="gstatic.com/"], img[src*="googleapis.com/"] { max-width: none; }'
if css.styleSheet
css.styleSheet.cssText = styles
else
css.appendChild(document.createTextNode styles)
document.getElementsByTagName("head")[0].appendChild css