Skip to content

Instantly share code, notes, and snippets.

View leopard627's full-sized avatar

Leopard627 leopard627

  • South Korea
  • 17:01 (UTC +09:00)
View GitHub Profile
@leopard627
leopard627 / .zshrc
Created January 22, 2018 02:50
oh_my_zsh_and_pycurl_problem...
LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:"${LD_LIBRARY_PATH}"
CPATH=/usr/local/opt/openssl/include:"${CPATH}"
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:"${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH CPATH PKG_CONFIG_PATH
import UIKit
import AVFoundation
var audioPlayer:AVAudioPlayer!
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
#!/bin/bash
echo "\033[1;34m"
cat << "EOF"
___ ____ _ _ ______
| \/ (_) | | (_) |___ /
| . . |_ __ _ _ __ __ _| |_ _ ___ _ __ / / ___ _ __ ___
| |\/| | |/ _` | '__/ _` | __| |/ _ \| '_ \ / / / _ \| '_ \ / _ \
| | | | | (_| | | | (_| | |_| | (_) | | | | ./ /__| (_) | | | | __/
\_| |_/_|\__, |_| \__,_|\__|_|\___/|_| |_| \_____/\___/|_| |_|\___|
@leopard627
leopard627 / posts.jsx
Last active September 1, 2018 10:06
react async fetch data from API
import React, { Component } from "react";
import axios from "axios";
class Posts extends Component {
state = {
posts: []
};
async componentDidMount() {
const response = await axios.get("http://localhost:8000/posts");
@leopard627
leopard627 / posts_2.jsx
Created September 1, 2018 11:06
react post
import React, { Component } from "react";
import axios from "axios";
const apiEndpoint = "http://localhost:8000";
class Posts extends Component {
state = {
posts: []
};
@leopard627
leopard627 / posts_thired.jsx
Created September 1, 2018 17:10
매우 허접하지만.... drf 에서 단순 post 가져오는 테이블이다.
import React, { Component } from "react";
import axios from "axios";
import { getPosts } from "../services/postService";
const apiEndpoint = "http://localhost:8000";
class Posts extends Component {
state = {
count: 0,
next: "",
let mut s = String::from("hello world");
let r1 = &s;
let r2 = &s;
let r3 = &mut s;
r3.push_str("Possible?");
@leopard627
leopard627 / search_foo.rs
Last active January 13, 2019 15:44
search worlds
fn search_foo(s: &String, word: &'static str) -> &'static str {
for (i, item) in s.chars().enumerate() {
if &s[i..i+3] == word {
return word
}
}
""
}
fn first_blank_finder(s: &String) -> Option<usize> {
let bytes = s.as_bytes();
for (i, &item) in bytes.iter().enumerate() {
if item == b' ' {
return Some(i)
}
}
Some(0 as usize)
}
fn first_blank_finder(s: &String) -> Option<usize> {
let bytes = s.as_bytes();
for (i, &item) in bytes.iter().enumerate() {
if item == b' ' {
Some(i)
}
}
Some(0 as usize)
}