Skip to content

Instantly share code, notes, and snippets.

View iToto's full-sized avatar
:octocat:
Helping to improve IAM @ GitHub

Salvatore D'Agostino iToto

:octocat:
Helping to improve IAM @ GitHub
View GitHub Profile
@iToto
iToto / users.js
Created November 6, 2012 02:32
Get all users
/**
+ \brief readUsers
+
+ This function will return all user objects to the client
+
+ \author Salvatore D'Agostino
+ \date 2012-11-05 20:47
+ \param response The response to return to the client
+ \param client (PSQL) PSQL client object
+
@iToto
iToto / convertArrayToDictiona.php
Created December 13, 2012 20:28
PHP function that creates key/value pair from a 2-dimensional array. NOTE: The original array must look something like this: Array ( [0] => Array ( [keyForKey] => KEY1 [keyForValue] => VALUE1 ) [1] => Array ( [keyForKey] => KEY2 [keyForValue] => VALUE2 ) )
<?php
/**
+ \brief convertArrayToDictionary
+
+ This function will take a 2-dimensional array with 2 keys in each index and convert it to a key-value pair array
+
+ \author Salvatore (Gimli) D'Agostino
+ \date Dec-13-2012
+ \param array (ARRAY) The array to convert (Must have 2 keys for every index)
+ \param key (STRING) The key of the key value (In the array param)
@iToto
iToto / calculateWindChillTemp.php
Last active December 14, 2015 08:39
calculateWindChillTemp
<?php
/**
+ \brief calculateWindChillTemp
+
+ This function will apply the wind chill temp
+
+ \author Salvatore D'Agostino
+ \date 2013-02-28 12:55
+ \param V The wind speed at 10 metres in km/h
+ \param Ta The Temperature in Celcius
@iToto
iToto / docx.sublime-snippet
Created March 6, 2013 20:13
PHP function snippet
<snippet>
<content><![CDATA[
/**
* \brief ${1:brief}
*
* ${2:description}
*
* \author Salvatore D'Agostino
* \date ${3:date}
* \param ${4:paramName} ${5:paramDescription}
@iToto
iToto / mySublimeText2Settings.sublime-settings
Last active December 15, 2015 05:09
my sublime text 2 settings
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Dayle Rees Color Schemes/Contrast/TronLegacy.tmTheme",
"detect_slow_plugins": true,
"draw_white_space": "all",
"fade_fold_buttons": true,
"find_selected_text": true,
"flatland_sidebar_tree_xsmall": true,
"flatland_square_tabs": true,
@iToto
iToto / banner.sublime-snippet
Created April 4, 2013 17:08
Banner Comment
<snippet>
<content><![CDATA[
// ==${1/./=/g}==
// = ${1:Your Comment Goes here} =
// ==${1/./=/g}==
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>banner</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.php</scope>
@iToto
iToto / wtf.sublime-snippet
Created April 12, 2013 12:50
what does this code do? Sublime Snippet
<snippet>
<content><![CDATA[
/**
¯\ /¯
\ _(ツ)_/ The following code was poorly documented and is in no way, shape or form coherent.
| |
**/
]]></content>
@iToto
iToto / pseudoBatchLoop.php
Last active December 16, 2015 14:09
pseudo batch loop
<?php
$i = 0;
$rowsPerXMLFile = 50;
foreach ($dataFromDB as $key => $value) {
if ($i == 0 || $i % $rowsPerXMLFile > 0 ) {
$batch = '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:yt="http://gdata.youtube.com/schemas/2007">
<batch:operation type="query" />
<entry>
<id>http://gdata.youtube.com/feeds/api/videos/HSTdgmhGwgc?v=2</id>
@iToto
iToto / convertMDToDocx.py
Created August 2, 2013 18:55
pandoc convert md to docx in folder
import os
import subprocess
for dirname, dirnames, filenames in os.walk('.'):
for filename in filenames:
if '.md' in filename:
print ("converting file: "+filename+" into: "+filename[:-3]+".docx")
subprocess.call("pandoc "+filename+" -f markdown -t docx -s -o "+filename[:-3]+".docx",stderr=subprocess.STDOUT,shell="true")
@iToto
iToto / uuidSample.php
Created September 11, 2013 18:54
uuid json&msgpak sample
<?php
Route::get('uuid/{uuid}',function($uuid){
echo "UUID: $uuid \n";
$array = array(
'UUID' => $uuid
);
echo "Original Array:\n";
var_dump($array);
echo "JSON:\n";
var_dump(json_encode($array));