Skip to content

Instantly share code, notes, and snippets.

@ganoro
ganoro / passjinni.create.js
Created December 15, 2022 17:41
Create a new pass
const accountId = 'PJ0XXXXXXXXX' // Your Account ID
const apiKey = 'your_api_key' // Your API Key
const passjinni = require('@passjinni/node')
const client = new passjinni(accountId, apiKey)
client.passes.create({
name: 'Elon Musk',
mobile: '+12345678901',
platform: 'ios',
}).then(pass => console.log(pass.url))
@ganoro
ganoro / js2xml.js
Created December 21, 2013 20:06
reverts node's xml2js library output
/**
* json2xml - Convert an xml2js JSON object back to XML
* @inspired_by Derek Anderson
*/
var json2xml = function(json, root, cb){
var recursion = 0;
var xml = '';
var isArray = function(obj) { return obj.constructor == Array; };
var parseAttributes = function(node){
@ganoro
ganoro / tap.css
Created October 11, 2012 22:14
tap
/* Overrides the highlight color shown when the user taps a link */
body
{
-webkit-tap-highlight-color: rgba(0,0,0,0);
}
@ganoro
ganoro / bind_events.js
Created October 11, 2012 20:48
click vs. touch
$(selector).click(function(event){
/* click event handler */
});
/* vs. */
$(selector).bind('touchend', function(event){
/* mimic the "native" tapping here... */
});
@ganoro
ganoro / template.xml
Created February 19, 2012 10:14
foreach-ify, for-ify and if-ify templates
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<templates>
<template autoinsert="true" context="php" deleted="false" description="for-each statement wrapper" enabled="true" name="foreachify">foreach (${dollar}${array_expression} as ${dollar}${value}) {&#13;
${word_selection}${cursor};&#13;
}&#13;
</template>
<template autoinsert="true" context="php" deleted="false" description="for statement wrapper" enabled="true" name="forify">for (${dollar}${index} = 0; ${dollar}${index} &lt; ${number_variable}; ${dollar}${index}++) {&#13;
${word_selection}${cursor};&#13;
}&#13;
</template>
@ganoro
ganoro / post_stage.php
Created December 6, 2011 19:28
Post stage script
<?
// get application location
$appLocation = getenv('ZS_APPLICATION_BASE_DIR');
// modify htaccess
$htaccess_file = $appLocation . '/web/.htaccess';
$explode = explode ( '/', $appLocation );
$appname = $explode [sizeof ( $explode ) - 2];
$content = file_get_contents ( $htaccess_file );
$content = str_replace ( '<application-name>', $appname, $content );
@ganoro
ganoro / index.php
Created November 29, 2011 11:42
wrong formatter #1
<?php
class AuthController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
@ganoro
ganoro / deployment.xml
Created November 27, 2011 19:43
deployment script
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<package xmlns="http://www.zend.com/server/deployment-descriptor/1.0" version="1.0">
<name>Symfony2Cloud</name>
<version>
<release>1.0.0</release>
</version>
<appdir>data</appdir>
<docroot>data/web</docroot>
<scriptsdir>scripts</scriptsdir>
</package>
@ganoro
ganoro / hello
Created November 27, 2011 14:53
<?
echo "hello world"
@ganoro
ganoro / hello
Created November 27, 2011 14:53
<?
echo "hello world"