Skip to content

Instantly share code, notes, and snippets.

View jesse1981's full-sized avatar
💭
Nerding

Jesse Bryant jesse1981

💭
Nerding
View GitHub Profile
const index = require('../index');
const YAML = require('yaml');
const fs = require('fs');
const express = require('express');
const router = express.Router();
router.use(function timeLog (req,res,next) {
console.log('Time: ',Date.now())
res.header('Access-Control-Allow-Origin', '*');
next();
const express = require('express');
const app = express();
var index = require('./routes/index');
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use('/', index);
// start the server
<?php
namespace Cloudinary {
class Cli
{
protected $plugin;
public function __construct($plugin)
{
$this->plugin = $plugin;
}
public function __invoke()
@jesse1981
jesse1981 / xmllib.php
Created January 9, 2014 22:38
Useful PHP functions to work with XMLs. libxml library is a required package
<?php
class xmlreader {
var $filename;
var $dataset;
public function __construct($filename) {
$this->filename = $filename;
$this->load($this->filename);
}
@jesse1981
jesse1981 / treesize.sh
Created July 19, 2013 07:18
Bash Script for viewing folder sizes. Just put this code into a file /bin/treesize and make it executable. Then any system user can get a list of directory sizes within a directory by just running treesize from any directory.
#/bin/sh
du -k --max-depth=1 | sort -nr | awk '
BEGIN {
split("KB,MB,GB,TB", Units, ",");
}
{
u = 1;
while ($1 >= 1024) {
$1 = $1 / 1024;
u += 1
window.fbAsyncInit = function() {
FB.init({
appId: 'Your_APP_ID',
status: true,
cookie: true,
xfbml: true,
oauth: true
});
showLoader(true);
@jesse1981
jesse1981 / inverse.php
Created June 10, 2013 05:10
Number inverse
<?php
function inverse($num,$max) {
for ($i=0;$i<=$max;$i++) {
if ($num == ($max-$i)) return $i;
}
}
?>
@jesse1981
jesse1981 / xmlUpdate.vbs
Created May 8, 2013 06:42
ASP XML search, update, delete example
Set xmlDoc = CreateObject("Msxml2.DOMDocument")
xmlDoc.async = false
xmlDoc.load("filename.xml")
' See if given id exists
Dim idExists, currParentNode
idExists = false
Set objNodeList = xmlDoc.selectNodes("/events/event/id")
For each x in objNodeList
@jesse1981
jesse1981 / getPageURL.vbs
Created May 8, 2013 06:36
Method to get the current page URL.
function curPageURL()
dim s, protocol, port
if Request.ServerVariables("HTTPS") = "on" then
s = "s"
else
s = ""
end if
protocol = strleft(LCase(Request.ServerVariables("SERVER_PROTOCOL")), "/") & s
@jesse1981
jesse1981 / flip.js
Last active June 20, 2021 23:33
Two sided DIV example with flip over animation. See Also: http://stackoverflow.com/questions/10035643/jquery-how-to-do-a-flip-effect
document.getElementById( 'signup' ).addEventListener( 'click', function( event ) {
event.preventDefault();
document.getElementById( 'side-2' ).className = 'flip flip-side-1';
document.getElementById( 'side-1' ).className = 'flip flip-side-2';
}, false );
document.getElementById( 'create' ).addEventListener( 'click', function( event ) {