Skip to content

Instantly share code, notes, and snippets.

View tysweezy's full-sized avatar
💯

Tyler Souza tysweezy

💯
View GitHub Profile
@tysweezy
tysweezy / time.js
Last active November 11, 2021 17:58
js datetime
var now = new Date(); // whatever datetime object you're grabbing from
var parseMonth = now.getMonth() + 1; // months start in zero for some reason
var month = parseMonth.toString();
var day = now.getDate().toString();
var year = now.getFullYear().toString();
// grabs current date in string -> add this to whatever element in DOM.
var currentDateText = month + "/" + day + "/" + year;
console.log(currentDateText);
@tysweezy
tysweezy / main.go
Created September 4, 2017 23:08
Playing around with file uploads in Go
package main
import (
"fmt"
"html/template"
"io/ioutil"
"log"
"net/http"
"os"
)
<?php
$errors = array();
$formNames = array(
"first_name",
"last_name",
// add more form fields
);
// promises in JS
var timer = new Promise((resolve, reject) => {
console.log("Init promise");
setTimeout(() => {
console.log("timeout done");
resolve();
}, 5000);
});
@tysweezy
tysweezy / feature_list.md
Created December 11, 2016 03:03
Web Dev Feed Feature List

Here is the feature list for Web Dev Feed (to be completed):

  • Add in markdown parsing for snippet posts.
  • Allow users to create their own posts (will have to add in some moderation for this).
  • Allow users to organize their posts by category (i.e. php, python, javascript, etc.).
def close_az(thing):
letters = list(thing) # turn string thing into list (array)
for l in letters:
# yo a close to z logic
@tysweezy
tysweezy / User.php
Last active February 26, 2016 21:39
<?php
// psr-2 namespaces and shit
class User extends Model {
public function roles()
{
return $this->belongsToMany('App\Role', 'roles_users');
}
def all_entry_hours():
entries = client.entries(7731168, 20150402, 20151115)
results = []
for entry in entries:
h = entry['day_entry']['hours']
results.append(h)
print sum(results)
@tysweezy
tysweezy / logic.py
Last active November 16, 2015 22:46
import json
import harvest
# harvest config
def get_project(project_id):
p = client.get_project(project_id)
if project_id != p:
raise ValueError('Project does not exist')
else:
@tysweezy
tysweezy / WikiFileRepository.php
Last active October 30, 2015 01:24
Repository for handeling wikis -- (Pseudocode/Concept)
<?php
namespace Wiki;
use Some\Markdown\Converter as Markdown;
use Illuminate\Database\Eloquent\Model;
use User; // assuming I have a user model
use Post; // assuming I have a post model
/**