Skip to content

Instantly share code, notes, and snippets.

@lanbau
lanbau / django_cheat_sheet.md
Created June 13, 2019 06:14 — forked from bradtraversy/django_cheat_sheet.md
Django command cheat sheet

Django 2.x Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder

python -m venv ./venv
@lanbau
lanbau / php2js-curl-basic-auth.js
Created August 27, 2018 09:38 — forked from kostasx/php2js-curl-basic-auth.js
PHP to Node.js: cURL with Basic Authentication
/*
<?php
// THE FOLLOWING IMPLEMENTATION CAN BE USED FOR VARIOUS APIs. THIS WAS TESTED SUCCESSFULLY ON THE pingdom.com API
$email = "[email protected]";
$passwd = 'password';
$api_key = "API_KEY";
$curl = curl_init();
@lanbau
lanbau / data-structure.js
Created June 2, 2018 14:33 — forked from sararob/data-structure.js
Role-based security in Firebase
/*
This example shows how you can use your data structure as a basis for
your Firebase security rules to implement role-based security. We store
each user by their Twitter uid, and use the following simplistic approach
for user roles:
0 - GUEST
10 - USER
20 - MODERATOR
@lanbau
lanbau / gist:7b5985cc9e2848aec086743a4a70f111
Created March 17, 2017 05:56 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://wzrd.in/standalone/expect@latest"></script>
</head>
<body>
@lanbau
lanbau / readme.md
Created October 26, 2016 09:08 — forked from coolaj86/how-to-publish-to-npm.md
How to publish packages to NPM

Getting Started with NPM (as a developer)

If you haven't already set your NPM author info, now you should:

npm set init.author.name "Your Name"
npm set init.author.email "[email protected]"
npm set init.author.url "http://yourblog.com"

npm adduser

@lanbau
lanbau / SavingsAccount.java
Created July 17, 2016 07:12 — forked from jimmykurian/SavingsAccount.java
A Java program that creates a Bank Account with withdraw, deposit, and intrest functions. And a tester class, that tests the SavingsAccount class.
//SavingsAccount.java - Jimmy Kurian
public class SavingsAccount
{
private double balance;
private double interest;
public SavingsAccount()
{
balance = 0;
@lanbau
lanbau / es6.md
Created March 29, 2016 02:04 — forked from jsstrn/es6.md
Intro to ES6

Introduction to ES6

Try ES6 online:

Getting ES6 to work in your browser

<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> <script type="text/babel" src="index.js"></script>

@lanbau
lanbau / manytomany.db
Created February 20, 2016 00:15 — forked from anonymous/manytomany.db
Many-to-many example
# For http://stackoverflow.com/a/7296873/396458
student: student_id, first_name, last_name
classes: class_id, name, teacher_id
student_classes: class_id, student_id # the junction table
students:
id | first | last
=====================
1 | John | Lee
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">