Skip to content

Instantly share code, notes, and snippets.

@hvtor
hvtor / App.js
Created December 4, 2018 22:28
How to add { JavaScript } in front of <Link></Link> tags
import React, { Component } from 'react';
import './App.css';
import { BrowserRouter as Router, Link, Redirect, Route } from 'react-router-dom';
import Auth from './modules/Auth';
import ThoughtRecordList from './components/ThoughtRecordList';
import RegisterForm from './components/RegisterForm';
import LoginForm from './components/LoginForm';
import ThoughtRecordForm from './components/ThoughtRecordForm';
import Features from './components/Features';
import React, { Component } from 'react';
import Auth from '../modules/Auth'
class Dashboard extends Component {
constructor() {
super();
this.state = {
myThoughtRecords: null,
thoughtRecordsLoaded: false,
}
import React, { Component } from 'react';
class ThoughtRecordList extends Component {
constructor() {
super();
this.state = {
thoughtRecordList: null,
thoughtRecordListLoaded: false,
}
}
@hvtor
hvtor / ThoughtRecord.js
Created November 9, 2018 19:51
Setup of React Final Form
import React from 'react'
import { Form, Field } from 'react-final-form'
import axios from 'axios'
const csrfToken = document.querySelector('[name="csrf-token"]').content;
axios.defaults.headers.common['X-CSRF-TOKEN'] = csrfToken;
const h1style = {
color: 'blue',
//Solved by Hemant Torsekar on August 19, 2016
//1. Write a method that takes a string reverses the order of the words in that string and returns the result.
func reverse(string: String)->String {
let reverseString = String(string.characters.reverse())
return(reverseString)
}
@hvtor
hvtor / HowToSymLink
Created July 16, 2015 17:14
Sublime Symlink
@hvtor
hvtor / Charges_Controller.rb
Last active August 29, 2015 14:21
Stripe Example : Stay Model which has Set_Deposit_Paid and Set_Balance_Paid Methods to Update Balance if Stripe Paid Tokens are Present; Guest Model Included for Reference
class ChargesController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => :deposit_payment
skip_before_filter :verify_authenticity_token, :only => :balance_payment
def new
end
def deposit_payment
@guest = Guest.find(session[:guest_id])
@hvtor
hvtor / application.js.coffee
Created May 8, 2013 16:45
Orgonom Gist Discussion
# This is a manifest file that'll be compiled into application.js, which will include all the files
# listed below.
#
# Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
# or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
#
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
# the compiled file.
#
# WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
@hvtor
hvtor / TTCSlowBot
Last active December 15, 2015 02:19
TTCSlowBot
require 'rubygems'
require 'twitter'
Twitter.configure do |config|
config.consumer_key = " "
config.consumer_secret = " "
config.oauth_token = " "
config.oauth_token_secret = " "
@hvtor
hvtor / hangman_test.rb
Created March 14, 2013 20:58
Hangman Unit Tests
require "test/unit"
require_relative "hangman2"
class HangmanTest < Test::Unit::TestCase
def test_intialize_starts_with_eight_chances
h = Hangman.new("kggdfdsa")
assert_equal 8, h.chances
end