Skip to content

Instantly share code, notes, and snippets.

View codenamejason's full-sized avatar
:octocat:
🫠

<jaxcoder /> codenamejason

:octocat:
🫠
View GitHub Profile
@codenamejason
codenamejason / 01-directory-structure.md
Created June 7, 2016 19:13 — forked from tkissing/01-directory-structure.md
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used
@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active September 19, 2026 09:21
Simple Github -> Discord webhook

Step 1 - Make a Discord Webhook

  1. Find the Discord channel in which you would like to send commits and other updates

  2. In the settings for that channel, find the Webhooks option and create a new webhook. Note: Do NOT give this URL out to the public. Anyone or service can post messages to this channel, without even needing to be in the server. Keep it safe! WebhookDiscord

Step 2 - Set up the webhook on Github

  1. Navigate to your repository on Github, and open the Settings Settings
@codenamejason
codenamejason / Scrambler.js
Created July 13, 2017 23:42
Scrables a string to privatize it
function Encode(str) {
// Rreplace every letter in the string with the letter following it
// by first getting the charCode number of the letter, adding 1 to it, then
// converting this new charCode number to a letter using the fromCharCode function
// we also check to see if the character is z and if so we simply convert the z to an a
var codedString = str.replace(/[a-z]/gi,
function(char) {
return (char === 'z' || char === 'Z') ? 'a' : String.fromCharCode(char.charCodeAt() + 1);
});
@codenamejason
codenamejason / ko-money.js
Last active July 26, 2017 19:25 — forked from jakiestfu/ko-money.js
Used to display formatted money via Knockout binding
(function(){
var toMoney = function(num){
if(num === null || num === undefined){
return 0;
}
// Use this if your number is a string:
// return '$' + (Number(num).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') );
return '$' + (num.toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,') );
};
@codenamejason
codenamejason / GetIndexes.sql
Created December 6, 2017 14:36
Get the indexes for an object
SELECT *
FROM sys.indexes
WHERE
--name='YourIndexName' AND
object_id = OBJECT_ID('<SCHEMA>.<TABLE>')
@codenamejason
codenamejason / numericText.js
Created December 6, 2017 15:31
Custom binding for displaying money values
// binding for displaying money values
ko.bindingHandlers.numericText = {
update: function (element, valueAccessor, allBindingsAccessor) {
var value = ko.utils.unwrapObservable(valueAccessor());
var precision = ko.utils.unwrapObservable(allBindingsAccessor().precision) ||
ko.bindingHandlers.numericText.defaultPrecision;
if (value === undefined || value === null) {
return;
}
var formattedValue = Number(value).toFixed(precision);
@codenamejason
codenamejason / logChange.js
Created December 6, 2017 15:32
Knockout Log/Logger Binding Handler
//- for testing (logchange)
ko.extenders.logChange = function (target, option) {
target.subscribe(function (newValue) {
console.log(option + " : " + newValue);
});
return target;
};
ko.bindingHandlers.logger = {
@codenamejason
codenamejason / objectSort.js
Created December 12, 2017 14:33
Sort an object
var sort_by = function() {
var fields = [].slice.call(arguments),
n_fields = fields.length;
return function(A, B) {
var a, b, field, key, primer, reverse, result;
for (var i = 0, l = n_fields; i < l; i++) {
result = 0;
field = fields[i];
@codenamejason
codenamejason / Connection.cs
Created March 14, 2018 18:13 — forked from lancscoder/Connection.cs
Dapper Getting Started
public class ConnectionFactory {
public static DbConnection GetOpenConnection() {
var connection = new SqlConnection("MyConnectionString");
connection.Open();
return connection;
}
}