Skip to content

Instantly share code, notes, and snippets.

View fourcolors's full-sized avatar
🎉
Perkisizing

fourcolors fourcolors

🎉
Perkisizing
View GitHub Profile
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
tab-width 2
@fourcolors
fourcolors / sort.js
Created June 21, 2017 00:51
sort problem
const sortedReference = [
'ITEM-1',
'ITEM-2',
'ITEM-3',
'ITEM-4',
'ITEM-5',
'ITEM-6',
'ITEM-7',
'ITEM-8',
'ITEM-9',
@fourcolors
fourcolors / .babelrc
Created June 15, 2017 20:08
Example for create react native app with alias
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins":
["transform-react-jsx-source",
["module-resolver",{
"root": ["./src"],
"alias": {
"screens": "./screens"
@fourcolors
fourcolors / buySell.js
Created May 19, 2017 02:35
Traditional Stock Buy Sell Problem
/*
* Problem: Transaction in k
* List the days to buy and days to sell
* Complexity
* p = prices
* k = transactions
*
* O(p + k)
*/
const daysToSell = (prices, k) => {
@seller.user_info_token = loop do
token = SecureRandom.urlsafe_base64
break token unless User.exists?(user_info_token: token)
end
PARTS = 3
LENGTH = 4
def self.generate(options = { parts: PARTS, part_length: LENGTH })
num_parts = options.delete(:parts)
length_of_parts = options.delete(:part_length)
parts = []
(1..num_parts).each do |i|
part = ''
@fourcolors
fourcolors / google_play_verification.rb
Created November 20, 2016 07:36 — forked from jkotchoff/google_play_verification.rb
Verifying an Android subscription in a Ruby on Rails app using the Google Play API
class GooglePlayVerification
require 'google/api_client'
# Refer:
# https://code.google.com/p/google-api-ruby-client/issues/detail?id=72
# and
# http://jonathanotto.com/blog/google_oauth2_api_quick_tutorial.html
# and
# http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/
GOOGLE_KEY = 'xxx-xxx.apps.googleusercontent.com'
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@fourcolors
fourcolors / gist:3977606705cc02553953
Created November 21, 2014 18:07
Sterling's Vimrc
"" ----------------------------------------------------------------------------
"" Random other items
"" ----------------------------------------------------------------------------
" Custom ignore for ctrl-p
let g:ctrlp_custom_ignore = '\v[\/]\.(DS_Storegit|hg|svn|optimized|compiled|node_modules)$'
"let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git'
" Ignore html in syntastic since it doesn't handle handlebars
let syntastic_mode_map = { 'passive_filetypes': ['html'] }
@fourcolors
fourcolors / index.html
Last active February 9, 2017 04:00
ReactJS with jQuery Dialog // source http://jsbin.com/zunud/4
<!DOCTYPE html>
<html>
<head>
<link href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.min.css" rel="stylesheet" type="text/css" />
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<script src="http://fb.me/react-0.3.0.js"></script>
<script src="http://fb.me/JSXTransformer-0.3.0.js"></script>
<meta charset="utf-8">