Skip to content

Instantly share code, notes, and snippets.

View duhruh's full-sized avatar
👽
Storming Area 51

David Rivera duhruh

👽
Storming Area 51
View GitHub Profile
@duhruh
duhruh / Dexter.java
Created June 11, 2012 22:14
TextToSpeech Object
import java.util.Locale;
import android.app.Activity;
import android.content.Intent;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Toast;
<?php
require 'google-api/apiClient.php';
require 'google-api/contrib/apiOauth2Service.php';
require 'google-api/contrib/apiDriveService.php';
$pdfFile = 'test.pdf';
// API Console: https://code.google.com/apis/console/
// Create an API project ("web applications") and put the client id and client secret in config.ini.
<script>
// (c) Copyright 2011 Caroline Schnapp. All Rights Reserved. Contact: [email protected]
// See http://wiki.shopify.com/Linked_Options
var Shopify = Shopify || {};
Shopify.optionsMap = {};
Shopify.updateOptionsInSelector = function(selectorIndex) {
@duhruh
duhruh / app.js
Created June 11, 2013 00:55 — forked from dskanth/app.js
var app = require('express').createServer()
var io = require('socket.io').listen(app);
var fs = require('fs');
app.listen(8008);
// routing
app.get('/', function (req, res) {
res.sendfile(__dirname + '/chat.html');
});
@duhruh
duhruh / app.js
Created June 18, 2013 13:25 — forked from kanreisa/app.js
var PORT = 10443;
var SSL_KEY = '___.key';
var SSL_CERT= '___.cert';
var fs = require('fs');
var io = require('socket.io').listen(PORT, {
key : fs.readFileSync(SSL_KEY).toString(),
cert : fs.readFileSync(SSL_CERT).toString()
});
@duhruh
duhruh / HEX2BIN.js
Created August 11, 2013 14:36 — forked from ghalimi/HEX2BIN.js
// Copyright (c) 2012 Sutoiku, Inc. (MIT License)
function HEX2BIN(number, places) {
// Return error if number is not hexadecimal or contains more than ten characters (10 digits)
if (!/^[0-9A-Fa-f]{1,10}$/.test(number)) return '#NUM!';
// Check if number is negative
var negative = (number.length === 10 && number.substring(0, 1).toLowerCase() === 'f') ? true : false;
// Convert hexadecimal number to decimal
/**
* sails-jwt-auth configuration and devdocs
*
*
*/
/**
authenticate : function(req,res){
var username = req.param('username')
var password = req.param('password')
if(!username || !password){
return res.json(403,{err : 'username and password required'})
}
User.findOneByUsername(username,function(err,user){
//issue a token, with an expiration date
var jwt = require('jsonwebtoken')
//issue token that expires after 10 mins AND has an issuer
var token = jwt.sign('helloworld','secret',{ expiresInMinutes : 10, issuer : 'hipster.io'});
//verify token, but don't check assertions.
autodetach on
shell -${SHELL}
defscrollback 2024
startup_message off
hardstatus on
vbell off
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'