Skip to content

Instantly share code, notes, and snippets.

View udithishara's full-sized avatar
🏠
Working from home

Udith Ishara Madusanka udithishara

🏠
Working from home
View GitHub Profile
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
//disable mouselook and movements
xAxisCam = gameObject.Find("Player").GetComponent("MouseLook");
xAxisCam.enabled = false;
yAxisCam = gameObject.Find("PlayerCamera").GetComponent("MouseLook");
yAxisCam.enabled = false;
Time.timeScale = 0;
@udithishara
udithishara / google-spreadsheet-reader.php
Created November 16, 2015 12:08 — forked from kosinix/google-spreadsheet-reader.php
Google spreadsheet reader in PHP
<?php
// URL to spreadsheet. Make sure to append ?alt=json to return contents in JSON format
$url = 'https://spreadsheets.google.com/feeds/list/0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc/od6/public/values?alt=json';
$file= file_get_contents($url);
$json = json_decode($file);
echo '<pre>'.print_r($json, 1).'</pre>';
@udithishara
udithishara / example.html
Created November 16, 2015 12:09 — forked from rilinweb/example.html
Get Google Spreadsheet Data
<?php
$spreadsheetID = '1pO7BBOkhWL2TcBPYkDTlWZ0Gbw4mAUSadK_8NOn0Ij8';
$urlPath = 'http://spreadsheets.google.com/feeds/list/' . $spreadsheetID . '/od6/public/values?alt=json';
$file = file_get_contents($urlPath);
$json = json_decode($file);
$rows = $json->{'feed'}->{'entry'};
?>
<!DOCTYPE html>
<html lang="en">
<head>
@udithishara
udithishara / gspreadsheet.php
Created November 16, 2015 12:09 — forked from felladrin/gspreadsheet.php
Listing Google Spreadsheet answers with PHP (Parsing JSON)
<?php
$key = '0AsfENoKj1ir7dE8yR6U0aUtpdTVNM20wRlNJOhZaclG';
$json_string = file_get_contents("https://spreadsheets.google.com/feeds/list/$key/od6/public/values?alt=json");
$obj = json_decode($json_string);
foreach ($obj->{'feed'}->{'entry'} as $entry)
{
echo "<p>";
$num_column = 0;
$answer = explode(', ', $entry->{'content'}->{'$t'});
foreach ($answer as $a)
@udithishara
udithishara / get_google_spreadsheet.php
Created November 18, 2015 06:46 — forked from uppfinnarjohnny/get_google_spreadsheet.php
A simple way of getting the data from a Google Docs Spreadsheet in PHP
<?php
function get_google_spreadsheet($key) {
$url = "https://spreadsheets.google.com/feeds/list/{$key}/od6/public/values";
$google_sheet = file_get_contents($url);
$xml = simplexml_load_string($google_sheet);
$data = array();
foreach($xml->entry as $entry) {
$row = array();
// The fields are in the gsx: namespace, so we need to specify that to be able to access them through SimpleXML.
@udithishara
udithishara / sheets-api-test-part2.php
Created November 20, 2015 05:02 — forked from karlkranich/sheets-api-test-part2.php
(obsolete due to Google changes) PHP code to use the Google Spreadsheets API with an OAuth Service Account. For more info, see http://karl.kranich.org/google-sheets-api-php
<?php
// Section 5: edit a row
// You'll need to get the etag and row ID, and send a PUT request to the edit URL
$rowid = 'cre1l'; // got this and the etag from the table data output from section 3
$etag = 'NQ8VCRBLVCt7ImA.';
$url = "https://spreadsheets.google.com/feeds/list/$fileId/od6/private/full/$rowid";
$method = 'PUT';
$headers = ["Authorization" => "Bearer $accessToken", 'Content-Type' => 'application/atom+xml', 'GData-Version' => '3.0'];
$postBody = "<entry xmlns=\"http://www.w3.org/2005/Atom\" xmlns:gsx=\"http://schemas.google.com/spreadsheets/2006/extended\" xmlns:gd=\"http://schemas.google.com/g/2005\" gd:etag='&quot;$etag&quot;'><id>https://spreadsheets.google.com/feeds/list/$fileid/od6/$rowid</id><gsx:gear>phones</gsx:gear><gsx:quantity>6</gsx:quantity></entry>";
$req = new Google_Http_Request($url, $method, $headers, $postBody);
// From - https://xomisse.com/blog/how-to-add-numbered-pagination-to-blogger/
function pagination(a) {
var e = "";
leftnum = parseInt(numshowpage / 2), leftnum == numshowpage - leftnum && (numshowpage = 2 * leftnum + 1), start = postnumber - leftnum, start < 1 && (start = 1), maximum = parseInt(a / postperpage) + 1, maximum - 1 == a / postperpage && (maximum -= 1), end = start + numshowpage - 1, end > maximum && (end = maximum), e += "<span class='totalpages'>Page " + postnumber + " of " + maximum + "</span>";
var s = parseInt(postnumber) - 1;
postnumber > 1 && (e += 2 == postnumber ? "page" == type ? '<span class="showpage"><a href="' + home_page + '">' + prevpage + "</a></span>" : '<span class="pagenumber"><a href="/search/label/' + lblname1 + "?&max-results=" + postperpage + '">' + prevpage + "</a></span>" : "page" == type ? '<span class="pagenumber"><a href="#" onclick="redirectpage(' + s + ');return false">' + prevpage + "</a></span>" : '<span class="pagenumber"><a href="#" onclick="redi
// https://github.com/mubaidr/vue2-migration-helper
import {
ref,
reacted,
toRefs,
watch,
computed,
onCreated,
onMounted,
@udithishara
udithishara / vue-tel-input-customized.vue
Created September 19, 2023 14:52 — forked from danielsmykowski1/vue-tel-input-customized.vue
A vue-tel-input component that is customized to get the look-and-feel of Vuetify components.
<template>
<div :class="topContainerClasses">
<div
v-click-outside="clickedOutside"
:tabindex="dropdownOptions && dropdownOptions.tabindex ? dropdownOptions.tabindex : 0"
:class="['vti__dropdown', { open: open }]"
@keydown="keyboardNav"
@click="toggleDropdown"
@keydown.esc="reset"
>