Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* This function will handle all of our file uploading
*/
function uploadFile(){
if(isset($_POST['upload_button'])){
$file = $_FILES['file_upload']; //This is our file variable
$name1 = $file['name'];
$ran = rand(0, 9999);
function findexts ($filename)
<?php
/**
* This function will handle all of our file uploading
*/
function uploadFile(){
if(isset($_POST['upload_button'])){
$file = $_FILES['file_upload']; //This is our file variable
$name1 = $file['name'];
$ran = rand(0, 9999);
@Zyber17
Zyber17 / Format.php
Created March 1, 2011 23:51
Odd bug
<?php
function format_result($result) {
if($result['type'] == 0) {pane($result);} /*else if($result['type'] == 1) { ticker($result); }*/ else { die(); }
}
function rename_name($name) {
return str_replace(' ', '', $name);
}
function pane($result) {
if($result['title']) {$title = ': '.$result['title'];}
$name = rename_name($result[name]);
@Zyber17
Zyber17 / Mod of Nate Boateng's Kiwi.app UI mod.css
Created June 6, 2013 15:14
I liked what Nate had sone for the most part (https://alpha.app.net/nkb/post/6449416), but wanted to make a few changes to best suit my style.
/* basic text and background properties */
/* ------------------------------------------------------------------------------------------ */
body {
-webkit-user-select: none;
word-wrap: break-word;
margin:0;
padding: 0;
border: 0;
widows: 100%;
overflow-x: hidden;
@Zyber17
Zyber17 / fixDate.coffee
Created July 18, 2013 03:37
Take that, Node.
fixDate = (wrongDate) ->
date = new Date(wrongDate)
date.setMinutes date.getMinutes() + new Date().getTimezoneOffset()
return date
@Zyber17
Zyber17 / collect.coffee
Last active December 21, 2015 02:19
Finally got it to work
collect = (args...,callback) ->
ret = {}
len = args.length
for i in [0...len]
for own k,v of args[i]
ret[k] = v
callback(ret)
###
In normal JS
@Zyber17
Zyber17 / which.coffee
Last active December 21, 2015 05:39
Which is the more semantically correct fun2?
fun1 = ->
fun2 true, (err, resp) ->
if !err
doStuff()
else
console.log "Error: #{err}"
res.end JSON.stringify err
fun2 = (val, callback) ->
if val
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
@Zyber17
Zyber17 / app.js
Last active December 22, 2015 04:28
App with setup and clusters
var app, cluster, cpu, cpus, express, http, path, setup;
cluster = require('cluster');
if (cluster.isMaster) {
if (process.env.NODE_ENV === 'setup') {
console.log('Starting setup process.');
express = require('express');
@Zyber17
Zyber17 / newserver.sh
Created October 5, 2013 16:57
Set up a new nginx/node server
sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove --purge
sudo rm -Rf "$(whereis apache2)"
sudo apt-get update -y
sudo apt-get upgrade -y
sudo apt-get install nginx nodejs npm g++ -y
ln -s /usr/bin/nodejs /usr/bin/node
npm install forever -g
sudo apt-get update -y