Skip to content

Instantly share code, notes, and snippets.

View adamgen's full-sized avatar
🚀
Developing software, and software developers 🤖

Adam adamgen

🚀
Developing software, and software developers 🤖
View GitHub Profile
@adamgen
adamgen / angular-router-remove-hash.js
Created August 25, 2015 12:09
angular router remove hash
$locationProvider.hashPrefix('!');
$locationProvider.html5Mode(true);
$locationProvider.baseHref = '/';
UPDATE `wp_postmeta`
SET `meta_value` = replace(meta_value , 'http://boredomtherapy.com', 'https://local.bt.com')
import numpy as np
def is_int(s):
try:
int(s)
return True
except ValueError:
return False
<!--JQUERY-->
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<!--BOOTSTRAP-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css"
// change old_key_name with new_key_name
db.collection.find().forEach(function(document) {
var old_key_name = document.old_key_name;
db.collection.update(
{ _id: document._id },
{
$set: {
new_key_name: old_key_name,
},
type a = 'aaa';
const b = 'a' + 'a' + 'a';
let c: a;
const IsA = (string: string): string is a => string === 'aaa';
c = b; // gives an error
if (IsA(b)) {
// any type of callable
type callable = (...args: any[]) => any;
// only acept values of object T
type ValueOf<T> = T[keyof T];
getAtts = (elem) => {
const attrs = {};
Object.values(elem.attributes).forEach(attr => {
attrs[attr.name] = attr.value;
});
return attrs
}
atts = getAtts($0);
d3Str = '';
d3Str += `.append('${$0.tagName}')\n`
@adamgen
adamgen / bash completeion
Last active August 29, 2019 07:09
initial bash profile scripts that run on startup
# install: brew install bash-completion
# then in .bash_profile
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Node: Nodemon",
"processId": "${command:PickProcess}",
"restart": true,
"protocol": "inspector",