Skip to content

Instantly share code, notes, and snippets.

View BunHouth's full-sized avatar
🎯
Focusing

Bunhouth BunHouth

🎯
Focusing
  • Remote Work
  • Phnom Penh
  • 17:45 (UTC +07:00)
  • X @bunhouth
View GitHub Profile
@BunHouth
BunHouth / embed-google-analytic.md
Created October 29, 2015 08:08
How to embed google analytic into website using ruby on rails?

How to embed google analytic into website?

<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<script type="text/javascript" src="jquery-1.8.1.min.js"></script>
<script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.0.23.min.js"></script>
<script>
var SightingObject;
var db;
// transform cropper dataURI output to a Blob which Dropzone accepts
function dataURItoBlob(dataURI) {
var byteString = atob(dataURI.split(',')[1]);
var ab = new ArrayBuffer(byteString.length);
var ia = new Uint8Array(ab);
for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i);
}
return new Blob([ab], { type: 'image/jpeg' });
}
@BunHouth
BunHouth / RCTScrollView.m
Created March 16, 2017 03:00
React-Native 0.28 Scrollview Patch for Xcode 8
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "RCTScrollView.h"
import React from "react";
import { StyleSheet, Text, View, ScrollView } from "react-native";
import axios from "axios";
export default class App extends React.Component {
state = {
data: []
};
async componentDidMount() {
await this.getTest();
const data = [
{id: 1, name: "meat", parent_id: null},
{id: 2, name: "vegi", parent_id: null},
{id: 3, name: "drink", parent_id: null},
{id: 4, name: "fish", parent_id: 1},
{id: 5, name: "beef", parent_id: 1},
{id: 6, name: "pork", parent_id: 1},
{id: 7, name: "raw", parent_id: 2},
{id: 8, name: "boiled", parent_id: 2},
{id: 9, name: "carbonate", parent_id: 3},
import React, {useState} from "react";
import "./App.css";
const data = [
{id: 1, name: "meat", parent_id: null},
{id: 2, name: "vegi", parent_id: null},
{id: 3, name: "drink", parent_id: null},
{id: 4, name: "fish", parent_id: 1},
{id: 5, name: "beef", parent_id: 1},
{id: 6, name: "pork", parent_id: 1},
{id: 7, name: "raw", parent_id: 2},
// React Section
import React, {memo} from "react";
import {Provider} from "react-redux";
import configureStore from "~/store/configureStore";
import Notification from "~/components/Notification";
const store = configureStore();
const RoomRateAvailabilityTableHeader = memo(({dates, name, isFamily}) => {
const renderElements = () => {
class SearchController < FrontendController
def index
@locations = locations
@search = Search.new(params, current_guest)
result = @search.paginate
respond_to do |format|
@data = { data: @search.search_results, total_count: @search.paginate[:total_count], total_pages: @search.paginate[:total_pages], per_page: 20, page: params[:page]}
query_params = params.except(:controller, :action, :search, :query).as_json
- title nil
- meta_description nil
= render partial: 'shared/header', locals: { search_bar: false, fixed_top: false }
.container
%h1.booking-header
= t('.book_no_pay_later')
.row