This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# deploying new production | |
echo "Starting production deployment" | |
# copy all files from current production to the temp directory | |
echo "Copying files to production temp directory" | |
cp -r /var/www/your-app/* /var/www/your-app.temp | pv -lep -s $(du -sb /var/www/your-app | awk '{print $1}') >/dev/null | |
# turn on temporary app server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "86f8898b-d2a7-4c49-acc4-fdbda6d65450", | |
"name": "Kelas Programming. REST API basics: CRUD", | |
"description": "# 🚀 Get started here\n\nThis template guides you through CRUD operations (GET, POST, PUT, DELETE), variables, and tests.\n\n## 🔖 **How to use this template**\n\n#### **Step 1: Send requests**\n\nRESTful APIs allow you to perform CRUD operations using the POST, GET, PUT, and DELETE HTTP methods.\n\nThis collection contains each of these [request](https://learning.postman.com/docs/sending-requests/requests/) types. Open each request and click \"Send\" to see what happens.\n\n#### **Step 2: View responses**\n\nObserve the response tab for status code (200 OK), response time, and size.\n\n#### **Step 3: Send new Body data**\n\nUpdate or add new data in \"Body\" in the POST request. Typically, Body data is also used in PUT request.\n\n```\n{\n \"name\": \"Add your name in the body\"\n}\n\n ```\n\n#### **Step 4: Update the variable**\n\nVariables enable you to store and re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const markah = [80, 99, 57, 40, 88, 39] | |
// kirakan purata | |
// // pseudocode | |
// // tambah semua, bahagi dengan bilangan | |
// let hasilTambahSemua = 0 | |
// markah.forEach((nombor) => { | |
// hasilTambahSemua = hasilTambahSemua + nombor | |
// console.log(hasilTambahSemua) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fundamental of any progamming langguage | |
1) variables | |
var namaVar = 'fikri' | |
let namaLet = 'fikri' | |
const namaConst = 'fikri' | |
const umur = 20 | |
const biodata = { | |
tarikh_lahir: '20-10-1999', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE IF EXISTS "public"."todo_items"; | |
-- This script only contains the table creation statements and does not fully represent the table in the database. It's still missing: indices, triggers. Do not use it as a backup. | |
-- Sequence and defined type | |
CREATE SEQUENCE IF NOT EXISTS todo_items_id_seq; | |
-- Table Definition | |
CREATE TABLE "public"."todo_items" ( | |
"id" int4 NOT NULL DEFAULT nextval('todo_items_id_seq'::regclass), | |
"text" text, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'google/apis/people_v1' | |
require 'googleauth' | |
# Set up authorization | |
scopes = ['https://www.googleapis.com/auth/contacts'] | |
credentials = Google::Auth::ServiceAccountCredentials.make_creds( | |
json_key_io: File.open('g_suite_service_account.json'), | |
scope: scopes, | |
) | |
credentials.sub = '[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
console.log('hi 1') | |
const data = fs.readFileSync('./file.md', 'utf8'); // blocks here until file is read | |
console.log(data); | |
console.log('hi 3') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
//create a server object: | |
http.createServer(function (req, res) { | |
res.write('Hello World!'); //write a response to the client | |
res.end(); //end the response | |
}).listen(5000); //the server object listens on port 8080 | |
// Console will print the message | |
console.log('Server running at 5000'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Node | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Filterable | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def filter(filtering_params) | |
results = self.where(nil) | |
filtering_params.each do |key, value| | |
results = results.public_send(key, value) if value.present? | |
end | |
results |
NewerOlder