Skip to content

Instantly share code, notes, and snippets.

@luaysuarna
luaysuarna / media-query.css
Created June 15, 2022 14:38 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@media screen and (min-width: 992px) and (max-width: 1199px) {
}
@media screen and (min-width: 768px) and (max-width: 991px) {
}
@media screen and (max-width: 767px){
@luaysuarna
luaysuarna / upload.rb
Created June 17, 2021 09:22
Ruby aws-sdk upload public image
config = {
region: Settings.aws.upload.region,
bucket: Settings.aws.upload.bucket_assets_name,
key: Settings.aws.access_key_id,
secret: Settings.aws.secret_access_key
}
Aws.config.update({
region: config[:region],
credentials: Aws::Credentials.new(config[:key], config[:secret])
@luaysuarna
luaysuarna / jenkins-api-start-and-monitor-a-build
Created July 24, 2020 23:56 — forked from markjlorenz/jenkins-api-start-and-monitor-a-build
Start a job with the Jenkins API and monitor it's console output
#! /usr/bin/env bash
JENKINS_URL="localhost:8080"
JOB_NAME="YourJobName
USER_NAME="api"
USER_TOKEN="f6706YOURUSERTOKENd2c51"
QUEUE_URL=$(curl --silent "http://${JENKINS_URL}/job/${JOB_NAME}/build" \
--user "${USER_NAME}:${USER_TOKEN}" \
--data "token=${JOB_TOKEN}" -XPOST \
@luaysuarna
luaysuarna / awk-example.sh
Created April 24, 2020 09:11 — forked from raecoo/awk-example.sh
awk/grep commands for Rails log analysis
# Access number
cat production.log | grep "^Processing" | wc | awk '{print $1}'
# Each IP access number
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq -c
# Independent IP number
cat production.log | grep "^Processing" | awk '{print $4}' | uniq | wc | awk '{print $1}'
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq | wc -l
@luaysuarna
luaysuarna / test.js
Last active March 21, 2018 02:45
Changing from React Redux - React Redux Saga
//
// Source: https://blog.logrocket.com/understanding-redux-saga-from-action-creators-to-sagas-2587298b5e71
//
// -------------------------------
// React Redux Plain
// -------------------------------
const {Provider, connect} = ReactRedux;
const createStore = Redux.createStore
@luaysuarna
luaysuarna / paddock.rb
Last active May 10, 2017 01:29
Paddock Equality
# In this example case when we create paddock objects we want them to be equal
# to each other if their name and area are the same and their lat/lng are "close
# enough" to each other. In our case we want "close enough" to mean the lat and
# lng match up to four decimal places.
#
# Download this file and the corresponding test case file tc_paddock.rb. Run the
# test case file like this `ruby tc_paddock.rb`. Currently all tests fail.
# Please make the changes you feel are necessary to make the tests pass, then
# make a gist with your version of paddock.rb and let us know.