Skip to content

Instantly share code, notes, and snippets.

View mfebrianto's full-sized avatar

michael febrianto mfebrianto

View GitHub Profile
<a href="#" onclick="NewServiceWizard.add_new_service_tariff({"data":{},"url":"http://localhost:3000/services/3612/service_tariffs/new"});; return false;">Add a new service tariff</a>
@mfebrianto
mfebrianto / 0_reuse_code.js
Created August 17, 2014 11:53
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<!-- path of this file : required_field_style/app/views/accounts/new.html.erb -->
<% form_for (@account), :url => '' do |f| %>
<%= f.label :account_no %><br />
<%= f.text_field :account_no %><br />
<%= f.label :company_name %><br />
<%= f.text_field :company_name %><br />
<% end %>
# location of this file : required_field_style/spec/required_field_style_spec.rb
require 'spec_helper'
module RequiredFieldStyle
describe '/accounts/new.html.erb', :type => :view do
it 'should render mandatory style for required field' do
required_field = 'Account no'
mandatory_style = '<sup style=\"color:red\">&nbsp;*</sup>'
assigns[:account] = Account.new
@mfebrianto
mfebrianto / grep_select_benchmark.rb
Last active August 29, 2015 14:18
performance comparison between grep vs select to get result of array_of_hash
require 'rubygems'
require 'benchmark'
phone1 = { phone_number: '0434889994', plan: 'standard' }
phone2 = { phone_number: '0452649226', plan: 'standard' }
phone3 = { phone_number: '0434556677', plan: 'data_only' }
phone4 = { phone_numner: '0434889995', plan: 'data_only' }
array_of_hash = [phone1, phone2, phone3, phone4]
proc_find = ->(s) {s[:plan] == 'standard'}
/opt/redis/redis-stable/src/redis-cli
HDEL schedules key check_instagram_tags_number
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
@mfebrianto
mfebrianto / AndroidManifest.xml
Created January 29, 2020 21:59
gist for android mock using webmock
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mock">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@mfebrianto
mfebrianto / MainActivity.kt
Last active January 29, 2020 22:25
main activity of mock app
package com.example.mock
import android.os.Bundle
import android.os.StrictMode
import androidx.appcompat.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_main.*
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
package com.example.mock
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.assertion.ViewAssertions
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.rule.ActivityTestRule
import org.hamcrest.core.StringContains
import org.junit.Rule