This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xmpp = require('node-xmpp'), | |
secret = require('./secret'), | |
util = require('util'); | |
var creds = { | |
jid: '[email protected]', | |
password: secret.pw, //string | |
}; | |
var GChat = function(creds) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
, path = require('path') | |
, _ = require('underscore'); | |
var rootPath = "/path/to/remove"; | |
removeDirForce(rootPath); | |
// path should have trailing slash | |
function removeDirForce(dirPath) { | |
fs.readdir(dirPath, function(err, files) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic XMPP bot example for HipChat using node.js | |
// To use: | |
// 1. Set config variables | |
// 2. Run `node hipchat_bot.js` | |
// 3. Send a message like "!weather 94085" in the room with the bot | |
var request = require('request'); // github.com/mikeal/request | |
var sys = require('sys'); | |
var util = require('util'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
camera = {} | |
camera._x = 0 | |
camera._y = 0 | |
camera.scaleX = 1 | |
camera.scaleY = 1 | |
camera.rotation = 0 | |
function camera:set() | |
love.graphics.push() | |
love.graphics.rotate(-self.rotation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// secure hashing of passwords using bcrypt, needs PHP 5.3+ | |
// see http://codahale.com/how-to-safely-store-a-password/ | |
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt | |
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)), '+', '.'), 0, 22); | |
// 2y is the bcrypt algorithm selector, see http://php.net/crypt | |
// 12 is the workload factor (around 300ms on my Core i7 machine), see http://php.net/crypt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Encode 'encode_utf8'; | |
my $s = ' ' . encode_utf8(pack 'U', 0x2605); | |
my $f = encode_utf8(pack 'U', 0xFF0F); | |
my $b = encode_utf8(pack 'U', 0xFF3C); | |
my $o = [ map { encode_utf8(pack 'U', $_) } ( | |
0x0069, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The API controller | |
Exports 3 methods: | |
* post - Creates a new thread | |
* list - Returns a list of threads | |
* show - Displays a thread and its posts | |
*/ | |
var Thread = require('../models/thread.js'); | |
var Post = require('../models/post.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A cute hack demonstrating one (weird?) way of doing optional | |
// parameters in Go. | |
// | |
// Please don't write code like this. It is fun code, though. | |
// | |
// Output: (see it live at golang.org) | |
// | |
// I like cheese. | |
// Do you like cheese too? | |
// I DO! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package coder; | |
import java.io.DataInputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.UnsupportedEncodingException; | |
import java.security.InvalidKeyException; |