Skip to content

Instantly share code, notes, and snippets.

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

<jaxcoder /> codenamejason

:octocat:
🫠
View GitHub Profile
@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 / 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 / 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 / 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);
});
@jagrosh
jagrosh / Github Webhook Tutorial.md
Last active May 7, 2025 23:23
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 / 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
0.990455599104
0.990131006372
0.988156953132
0.986346333872
0.980186977796
0.979454414848
0.97899422699
0.978388958838
0.978292975683
0.978014174891
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
@codenamejason
codenamejason / animate.css
Created March 3, 2015 18:25
Animate with CSS
/*Setup WOW.js
1
Link to the CSS animation library
Link to Animate.css
(You can link to another CSS animation library by changing WOW.js settings)
<link rel="stylesheet" href="css/animate.css">