Skip to content

Instantly share code, notes, and snippets.

View nallwhy's full-sized avatar

Jinkyou Son nallwhy

View GitHub Profile
@nallwhy
nallwhy / .gitignore
Last active December 28, 2015 14:28
*.iml
/.idea/workspace.xml
/.idea/libraries
.DS_Store
# Built application files
*.apk
*.ap_
# Files for the Dalvik VM
@nallwhy
nallwhy / search.pipe.ts
Created July 8, 2016 05:26
[Angular2] SearchPipe
// usage: {{ payments | search:'info.holder':holderSearchKey }}
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'search',
pure: false
})
export class SearchPipe implements PipeTransform {
transform<T>(value: T[], propertyKey: string, searchKey: string, ignoreCase: boolean = true): T[] {
def facebook
render_api 400, "Missing fields" and return unless check_params(facebook_params, [:id, :access_token])
begin
facebook_user = FbGraph2::User.me(params[:access_token]).fetch(fields: [:name, :email, :gender, :birthday, "picture.height(300)"])
user = User.find_by_email(facebook_user.email)
if user.nil?
# crate
meta = {
public class ServiceGenerator {
private static ServiceGenerator instance = null;
private final String BASE_URL = AppParams.getInstance().API_URL;
private Context context = null;
private Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create());
private OkHttpClient.Builder httpClientBuilder = null;
//
// HttpClient.swift
// Secretvill
//
// Created by Jinkyou Son on 2017. 1. 6..
// Copyright © 2017년 ultramarine. All rights reserved.
//
import Alamofire
import ReactiveKit
@nallwhy
nallwhy / BrewFile
Last active August 19, 2019 01:42
BrewFile
tap "bbatsche/fisher"
brew "asdf"
brew "awscli"
brew "fish"
brew "fzf"
brew "git"
brew "mas"
brew "peco"
brew "thefuck"
brew "bbatsche/fisher/fisherman"
@nallwhy
nallwhy / gist:3858c75f89b5266ad3239d14213f09a5
Last active August 21, 2022 14:36
Definject with no do case
defmodule DefinjectPlayground do
import Definject
# definject hello(who, opts \\ [])
# definject hello(name_list, _opts) when is_list(name_list), do: name_list |> Enum.map(& "Hello, #{&1}")
# definject hello(name, _opts) when is_binary(name), do: "Hello, #{name}"
def hello(who, opts \\ [])
def hello(name_list, _opts) when is_list(name_list), do: name_list |> Enum.map(& "Hello, #{&1}")
def hello(name, _opts) when is_binary(name), do: "Hello, #{name}"
[
{
"date": "2023-02-11",
"report_coount": 7
},
{
"date": "2023-02-10",
"report_coount": 11
},
{
@nallwhy
nallwhy / gist:0ddb3a32f9ccc502ecc06e991ca104a4
Created January 19, 2024 05:08
IsNil Ash validation (validate the fields are nil)
defmodule MyApp.Validation.IsNil do
use Ash.Resource.Validation
alias Ash.Error.Changes.{NoSuchAttribute, InvalidAttribute}
@impl true
def init(opts) do
{:ok, opts}
end
@impl true
@nallwhy
nallwhy / server.exs
Last active March 5, 2024 23:50
AshPhoenix Form is not valid
Application.put_env(:sample, SamplePhoenix.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 5001],
server: true,
live_view: [signing_salt: "aaaaaaaa"],
secret_key_base: String.duplicate("a", 64)
)
Mix.install([
{:plug_cowboy, "~> 2.7"},
{:jason, "~> 1.0"},