Skip to content

Instantly share code, notes, and snippets.

View punkrocker178's full-sized avatar
🎯
Focusing on angular4reddit.me

Hieu punkrocker178

🎯
Focusing on angular4reddit.me
  • Ho Chi Minh City
View GitHub Profile
@punkrocker178
punkrocker178 / download-img.sh
Last active November 3, 2023 05:20
Download images from resource servers such as wp-content.
#!/bin/bash
# Link to download resource as first argument
base_url=$1
# end
# Number to stop the incrementing id
end_id=$2
# starting id, will default to 1 if empty
@punkrocker178
punkrocker178 / git-commands.sh
Last active September 18, 2021 10:34
Git commands
# Add remote
git remote add origin https://github.com/user/repo.git
# Save git credential
git config --global credential.helper store
# Enable this to separate git credentials for different repos
git config --global credential.github.com.useHttpPath true
# Delete branch local (multiple delete):
@punkrocker178
punkrocker178 / Teamcity-docker-compose.yml
Last active November 3, 2020 02:52
Docker container related commands
version: '3.5'
services:
teamcity-server:
image: jetbrains/teamcity-server:latest
volumes:
- ./server/data:/data/teamcity_server/datadir
- ./server/log:/opt/teamcity/logs
ports:
- 8080:8111
@punkrocker178
punkrocker178 / index.html
Last active November 3, 2020 03:15
Generates random number on a fixed table (https://jsbin.com/qubuzoh)
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
button{
display:block;
height:60px;
width:100px;
@punkrocker178
punkrocker178 / mostFrequentWord.js
Created August 22, 2018 04:03
Analyze a most frequent word program Thinkful Unit 2 Lesson 6
function getTokens(rawString) {
// NB: `.filter(Boolean)` removes any falsy items from an array
// .split : split words from to to an array,input of spliting is Regex.This Regex means ignore white space character and any other special characters like commas,semi-colon,exclamation marks,etc...
// .sort : sorting words in an alphabetical order.
return rawString.toLowerCase().split(/[ ,!.";:-]+/).filter(Boolean).sort();
}
function mostFrequentWord(text) {
var words = getTokens(text);
console.log(words);
@punkrocker178
punkrocker178 / objDrills2.js
Created August 22, 2018 03:30
Thinkful Unit 2 Lesson 6 Object Drills 2
https://jsbin.com/covokoj/2/edit?html,js,output
https://jsbin.com/taxavab/edit?html,js,console,output
https://jsbin.com/govafuc/edit?html,js,console,output
https://jsbin.com/kezicus/edit?html,js,console,output
https://jsbin.com/xiwidog/edit?js,console,output
@punkrocker178
punkrocker178 / objDrills.js
Created August 21, 2018 14:14
Thinkful Unit 2 Lesson 6 Object Drills 1
https://jsbin.com/lurosel/edit?html,js,console,output
https://jsbin.com/zorovip/edit?html,js,console,output
https://jsbin.com/cahoray/edit?html,js,console,output
https://jsbin.com/jidodef/edit?html,js,console,output
@punkrocker178
punkrocker178 / arrayLoops.js
Created August 20, 2018 15:22
Thinkful Unit 2 Lesson 4 Array&Loops Drills
https://jsbin.com/molimos/edit?html,js,console,output
https://jsbin.com/toyumed/edit?html,js,console,output
https://jsbin.com/telamiy/edit?html,js,console,output
@punkrocker178
punkrocker178 / Links
Last active August 19, 2018 15:35
Thinkful Unit 2 Lesson 4 Array Drills
@punkrocker178
punkrocker178 / logicDrills.js
Created August 18, 2018 07:49
Thinkful Unit 2 Lesson 3 Logic drills
/*-----------------------------------Drill 1-------------------------------*/
function doTrafficLights() {
var activeLight = getActiveLight();
// your code will replace this call
// to `console.log()`
if(activeLight==="red"){
turnRed();
}
else if(activeLight==="green"){