Skip to content

Instantly share code, notes, and snippets.

@andreaj8
andreaj8 / gist:f9b4d9864d1220259e5b
Last active August 29, 2015 14:22
Socket Push NodeJs proxy design
[Pagina di testing PHP]
1) PHP serve una pagina munita di un ID univoco (come simulazioned di utente in sessione)
2) La pagina servita si collega ad un server per il socket [server node]
3) la pagina ha un tasto like, che chiama PHP e simula l'operazione di like, dopo di che la pagina PHP fa una chiamata HTTP GET ad un andPoint del server NODE con due parametri GEt : ID, messaggio
[Server NODE]
1) Espone un endpoint
2) Alla ricezine della chiamata manda un messaggio al client ID con il messaggio
@andreaj8
andreaj8 / gist:cc55408a25faeb4d6306
Created September 8, 2015 14:44
parallel count query in one model for single params
// Use MongoDB 3.0 group() function for getting users and count attribute
function countUsersAttributes(_key, _cond) {
var deferred = Q.defer();
db_mongo_driver.users.group({
key: _key,
cond: _cond,
reduce: function (value, result) {
result.count++;
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="20206" android:versionName="2.2.6" package="***********" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN"
@andreaj8
andreaj8 / gmail_auth.js
Last active May 20, 2017 19:55
Gmail Get Auth Token
/*
https://medium.com/@andrea_j24/come-trasformare-le-email-in-richieste-http-84c178480d1f
npm install google-auth-library readline
node gmail_auth.js
*/
var googleAuth = require('google-auth-library');
var readline = require('readline');
// See scopes : https://developers.google.com/gmail/api/auth/scopes

Keybase proof

I hereby claim:

  • I am andreaj8 on github.
  • I am jay24 (https://keybase.io/jay24) on keybase.
  • I have a public key ASDurg5ksrnhgN8mB4OQE2s9YRQxxIP8BAst52GEXQnaCQo

To claim this, I am signing this object: