Skip to content

Instantly share code, notes, and snippets.

Avatar

Kosinix kosinix

  • Philippines
View GitHub Profile
View password-man.js
/**
* Generates random string and password hashing
* @type {module:crypto}
*/
//// Core modules
const crypto = require('crypto');
const util = require('util');
//// External modules
@kosinix
kosinix / gist:ce3dcccaf50105b5c2248c084eb21ac2
Created Jun 12, 2020
Update gitignore and remove from repo
View gist:ce3dcccaf50105b5c2248c084eb21ac2
git rm -r --cached .
git add .
git commit -m 'Removed all files that are in the .gitignore'
@kosinix
kosinix / user.js
Created Jul 14, 2019
Express - Mongoose: Basic user table with password hash and checking methods.
View user.js
//// Core modules
const crypto = require('crypto');
const util = require('util');
//// External modules
const mongoose = require('mongoose');
//// Modules
const randomBytesAsync = util.promisify(crypto.randomBytes);
@kosinix
kosinix / d.js
Created Jun 22, 2019
Kinabukasan ni Daggy
View d.js
// Modules
const express = require('express')
const mysql = require('mysql')
const bodyParser = require('body-parser')
// Settings
const port = 3000
// Express
const app = express()
@kosinix
kosinix / win.md
Created Apr 20, 2018
Disable Taskbar Grouping Windows 10 for Power User
View win.md

Disable Taskbar Grouping Windows 10 for Power User

Applies to inactivated windows too

Regedit

  • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced
  • if it doesn't already exist, make a new DWORD value first (32 bit) and name it TaskbarGlomLevel
  • value hexadecimal 2
@kosinix
kosinix / bitsbytes.md
Last active Apr 8, 2018
Quick intro to binary if you eat binary for dinner
View bitsbytes.md

1 hex (aa) = 1 byte = 8 bits (1010 1010)

Name Size
bit 1 bit
nybble 4 bits
byte 8 bits
hex 8 bits or 1 byte
halfword 16 bits
View gitgotcha.md

Save vim commit message

Press ESC to make sure you are out of the edition mode and then type:

:wq

Delete remote branch

@kosinix
kosinix / gotcha.js
Last active Oct 29, 2017
JS promise API gotchas
View gotcha.js
function errorFunction(){
return Promise.reject('Reject value.');
}
function goodFunction(error=false){
return Promise.resolve('Resolved value.');
}
// Example 1. One level
goodFunction().then(function(ok){
console.log('First "then" called. Value: ', ok);
@kosinix
kosinix / excerpt.php
Created Jun 29, 2017
Read more that ends in sentence or exact words.
View excerpt.php
<?php
add_filter( 'the_content', 'my_the_content_filter', 22 );
function my_the_content_filter( $content ) {
if ( is_home() || is_archive() || is_search() ){
// Mode word
$mode = 'sentence'; // word or sentence
$count = 11;
View starterwp.css
/*
Theme Name: Turbo Surfing
Theme URI: #
Author: Team Perth
Author URI: #
Description: A theme for turbosurfing.com.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: turbosurfing
You can’t perform that action at this time.