Skip to content

Instantly share code, notes, and snippets.

View TRex22's full-sized avatar
🎮
Life

Jason Chalom TRex22

🎮
Life
View GitHub Profile
public async Task<string> CreateDocument(string collectionName, BsonDocument document)
{
string message = "nothing has happened";
var collection = _mongoDatabase.GetCollection<BsonDocument>(collectionName);
//insert collection
await collection.InsertOneAsync(document);
message = "updated data";
return message;
}
public async void DoLogic()
{
BsonDocument document;
Console.WriteLine("This program will generate some data when option A is selected.");
Console.WriteLine("Option B will find some data.");
Console.WriteLine("Option C (any other input) will display data from database.");
var input = Console.ReadLine();
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Bson;
using MongoDB.Driver;
using MongoDbWrapper;
namespace MongoDbExampleDataGenerator
@TRex22
TRex22 / baseController.js
Last active December 14, 2015 08:32
AngularJs Pagination ... with some hacks. Pretty much used for older version of Angular (very old versions)
//pagination for all
$scope.pagination = {};
$scope.pagination.pageSize = 3;
$scope.pagination.currentPage = 1;
$scope.pagination.totalPages = 1;
$scope.pagination.totalItems = 0;
$scope.pagination.hasNextPage = false;
$scope.pagination.hasPreviousPage = false;
function firstPage(fn){
@TRex22
TRex22 / example.js
Created September 25, 2016 20:30 — forked from swarajgiri/example.js
example
function mySexyMethod() {
return new Promise(function (resolve, reject) {
someAsync.method(params, function (err, data) {
if (err) {
return reject(err);
}
resolve(data);
})
});
@TRex22
TRex22 / slack_history.py
Created March 7, 2017 11:35 — forked from Chandler/slack_history.py
Download Slack Channel/PrivateChannel/DirectMessage History
# MIT License
# Copyright (c) 2016 Chandler Abraham
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@TRex22
TRex22 / PyFM_Player_Makezine.py
Created June 7, 2017 10:22
PIFM Make Magazine Player edited for a project I am working on
#!/usr/bin/env python
# Pirate Radio
# Author: Wynter Woods (Make Magazine)
# Edited by @TRex22 (Jason Chalom)
import os
import sys
import subprocess
import configparser
import re
@TRex22
TRex22 / happy_git_on_osx.md
Last active February 5, 2018 14:42 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "[email protected]"

@TRex22
TRex22 / fix-brew.md
Last active September 1, 2018 06:26
Fixing Homebrew, rails (rvm) and any other dev environment stuff after a mac machine transfer or some other disaster

Some hints and tips and things to try when something goes awry with Homebrew, gem or npm

If dtrace is not working correctly when trying to build packages (like gems or npm packages)

rvm install 2.3.5 -- --disable-dtrace

You can write the installed brews to a list on your old machine:

@TRex22
TRex22 / git_addall.sh
Created April 4, 2018 08:21
A bash script to help with ruby on rails development. It will warn you when there is a `focus` or a `binding.pry` being staged in your code. Future versions of this will use variables and maybe identify the specific code (I dont really have plans for any of this atm)
#!/bin/bash
# git config --global alias.addall '! ~/git_addall.sh'
git diff|grep 'focus' --color
git diff --name-only | xargs grep --color -Hn focus
git diff|grep 'binding.pry' --color
git diff --name-only | xargs grep --color -Hn binding.pry
git add --all
git status