Skip to content

Instantly share code, notes, and snippets.

View alexpchin's full-sized avatar

Alex Chin alexpchin

View GitHub Profile
@alexpchin
alexpchin / Setting_upa_new_repo.md
Last active May 12, 2024 17:06
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"

git remote add origin git@github.com:alexpchin/.git

@alexpchin
alexpchin / Check_Filesize_in_Terminal.md
Created June 17, 2014 10:40
Check Filesize in Terminal

du -sh *

@alexpchin
alexpchin / Meta Tags
Last active August 29, 2015 14:02
Meta Tags
<!-- for Google -->
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="copyright" content="" />
<meta name="application-name" content="" />
<!-- for Facebook -->
<meta property="og:title" content="" />
<meta property="og:type" content="article" />
@alexpchin
alexpchin / DefaultKeyBinding.dict
Created August 4, 2014 08:52
DefaultKeyBinding.dict
{
/* Map # to § key*/
"§" = ("insertText:", "#");
}
@alexpchin
alexpchin / Spinning
Created February 16, 2015 15:21
Spinning
javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; var DI= document.images; DIL=DI.length; function A(){for(i=0; i < DIL; i++){DIS=DI[ i ].style; DIS.position='absolute'; DIS.left=Math.sin(R*x1+i*x2+x3)*x4+x5+"px"; DIS.top=Math.cos(R*y1+i*y2+y3)*y4+y5+"px"}R++}tag=setInterval('A()',5 );document.onmousedown=function(){clearInterval(tag);for(i=0; i < DIL; i++){DI.style.position="static";}}; void(0)

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.

Update

@alexpchin
alexpchin / Sublime_3_Keyboard_Shortcuts.md
Created March 15, 2015 19:41
Sublime 3 Keyboard Shortcuts
Keypress Action
cmd + s save changes in current file - DO IT OFTEN!!!
cmd + q close Sublime
cmd + w close one file at a time
cmd + alt + arrow switch between files
cmd + numbers also switch between specific files
cmd + f search in you current file
cmd + shift + f search the entire project
cmd + d go to next searched word in file
@alexpchin
alexpchin / cli_keyboard_shortcuts.md
Created March 16, 2015 18:00
CLI Keyboard Shortcuts
Keypress Action
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + L Clears the Screen, similar to the clear command
Ctrl + U Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H Same as backspace
Ctrl + R Let’s you search through previously used commands
Ctrl + C Kill whatever you are running
Ctrl + D Exit the current shell
@alexpchin
alexpchin / progression_of_html.md
Created March 21, 2015 18:35
Progression of HTML
Type of content HTML 1.2 HTML 4.01 HTML5 Purpose
Heading Yes Yes Yes Organize page content by adding headings and subheadings to the top of each section of the page
Paragraph Yes Yes Yes Identify paragraphs of text
Address Yes Yes Yes Identify a block of text that contains contact information
Anchor Yes Yes Yes Link to other web content
List Yes Yes Yes Organize items into a list
Image Yes Yes Yes Embed a photograph or drawing into a web page
Table No Yes Yes Organize data into rows and columns
Style No Yes Yes Add CSS to control how objects on a web page are presented
@alexpchin
alexpchin / progresson_of_html.md
Created March 25, 2015 10:47
Progression of HTML
Type of content HTML 1.2 HTML 4.01 HTML5 Purpose
Heading Yes Yes Yes Organize page content by adding headings and subheadings to the top of each section of the page
Paragraph Yes Yes Yes Identify paragraphs of text
Address Yes Yes Yes Identify a block of text that contains contact information
Anchor Yes Yes Yes Link to other web content
List Yes Yes Yes Organize items into a list
Image Yes Yes Yes Embed a photograph or drawing into a web page
Table No Yes Yes Organize data into rows and columns
Style No Yes Yes Add CSS to control how objects on a web page are presented