Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

Joseph An josephan

🌴
On vacation
View GitHub Profile
View gist:eafeee5b31de84bfa472
redis-server /usr/local/etc/redis.conf
@josephan
josephan / SassMeister-input-HTML.html
Created Nov 27, 2015
Generated by SassMeister.com.
View SassMeister-input-HTML.html
<div class="row">
<select>
<option value="hydrogen" class=>hydrogen</option>
<option value="lithium" class=>lithium</option>
<option value="helium" class=>helium</option>
<option value="nitrogen" class=>nitrogen</option>
<option value="carbon" class=>carbon</option>
<option value="oxygen" class=>oxygen</option>
<option value="nitrogen" class=>nitrogen</option>
</select>
View index.ios.js
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
@josephan
josephan / joseph.exs
Last active Sep 29, 2021
Recursive implementation of reduce and reverse in Elixir
View joseph.exs
defmodule Joseph do
@moduledoc """
This is my module for the challenges from Elixir TV episode 6
"""
@doc """
Reduces a list to a single value from running a function.
Returns an numeric value.
@josephan
josephan / MainPage.cs
Created Nov 11, 2016
react-native-device-info for React Native Windows
View MainPage.cs
using ReactNative;
using ReactNative.Modules.Core;
using ReactNative.Modules.RNDeviceInfo;
using ReactNative.Shell;
using System.Collections.Generic;
namespace AwesomeProject
{
class MainPage : ReactPage
{
View deprecation_message.ex
# Programming Phoenix Version: P1.0 (April 2016)
# I have the following changeset for my User model:
def changeset(model, params \\ :empty) do
model
|> cast(params, ~w(name username), [])
|> validate_length(:username, min: 1, max: 20)
end
# but I get the following deprecation warning
@josephan
josephan / mix.md
Created Jun 21, 2017
Dependency issues
View mix.md
  defp deps do
    [{:phoenix, "~> 1.2.1"},
     {:phoenix_pubsub, "~> 1.0"},
     {:phoenix_ecto, "~> 3.0"},
     {:postgrex, ">= 0.0.0"},
     {:phoenix_html, "~> 2.6"},
     {:phoenix_live_reload, "~> 1.0", only: :dev},
     {:gettext, "~> 0.11"},
 {:cowboy, "~&gt; 1.0"},
@josephan
josephan / lecture1.ex
Last active Jul 17, 2017
Computer Science 61A - Lecture 1: functional programming 1
View lecture1.ex
defmodule Lecture1 do
def add(list), do: add(list, 0)
defp add([h | t], acc), do: add(t, acc + h)
defp add([], acc), do: acc
def mult(list), do: mult(list, 1)
defp mult([h | t], acc), do: mult(t, acc * h)
defp mult([], acc), do: acc
end
@josephan
josephan / game_of_life.rb
Created Jul 29, 2017
Conway's Game Of Life
View game_of_life.rb
class GameOfLife
attr_reader :height, :width
def initialize
@board = {
[10,10] => true,
[10,11] => true,
[10,12] => true,
}
@height = 40