This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"#" + ((1<<24)*Math.random()|0).toString(16) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(navigator.userAgent).match(/OS\s+([\d\_]+)/i)[0].replace(/_/g, '.').replace('OS ', '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NUMBER1 := 10 | |
NUMBER2 := 5 | |
#Addition | |
ADD := $(shell echo ${NUMBER1}+${NUMBER2} | bc) | |
#Subtraction | |
SUBTRACT := $(shell echo ${NUMBER1}-${NUMBER2} | bc) | |
#Multiplication |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../components/polymer/polymer.html"> | |
<polymer-element name="my-element"> | |
<template> | |
</template> | |
<script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="../paper-button/paper-button.html"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> | |
#paper_button { | |
left: 310px; | |
top: 110px; | |
position: relative; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.checkBrowser = -> | |
ua = navigator.userAgent | |
M = ua.match(/(opera|yabrowser|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) | |
if /trident/i.test(M[1]) | |
tem = /\brv[ :]+(\d+)/g.exec(ua) or [] | |
return name: 'ie', version: (tem[1] or '') | |
if M[1] is 'Chrome' | |
if (tem = ua.match(/\bOPR\/(\d+)/))? | |
return name: 'opera', version: tem[1] | |
if (tem = ua.match(/\bYaBrowser\/(\d+)/))? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pre-requisites: | |
// 1. Device core plugin | |
// 2. Splashscreen core plugin (3.1.0) | |
// 3. config.xml: <preference name="AutoHideSplashScreen" value="false" /> | |
// 4. config.xml: <preference name="DisallowOverscroll" value="true" /> | |
function onDeviceReady() { | |
if (parseFloat(window.device.version) >= 7.0) { | |
document.body.style.marginTop = "20px"; | |
// OR do whatever layout you need here, to expand a navigation bar etc |
NewerOlder