Skip to content

Instantly share code, notes, and snippets.

View magichim's full-sized avatar
🎯
Focusing

Songwon Park magichim

🎯
Focusing
View GitHub Profile
@bastienrobert
bastienrobert / README.md
Last active April 9, 2020 10:22
Script to open chrome with specific URL gived in params

OpenChrome

Inspired by Create React App

This script is checking in every chrome window if there's a tab with the URL gived in params:

  • If there's one: It opens chrome in first-ground and show the good chrome window with the good tab
  • If there's multiples: Same behavior but it use the first tab found
  • If there's not: It launch chrome (if it's not open) and create a new tab with the given URL

How it works

osascript openChrome.scpt YOUR_FORMATTED_URL

@betweenbrain
betweenbrain / read-files.js
Created December 5, 2016 22:35
Node.js read multiple files, write into one
var fs = require('fs');
var Promise = require('promise');
var promises = [];
var readline = require('readline');
var readFile = function (file) {
return new Promise(function (resolve, reject) {
var lines = [];
var rl = readline.createInterface({
input: fs.createReadStream('./logs/' + file)
@onderaltintas
onderaltintas / degrees2meters.js
Last active April 12, 2022 01:38 — forked from springmeyer/degress2meters.js
javascript coordinate conversions between 900913(3857) - 4326(lat lon)
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
//test
lon= -77.035974
lat = 38.898717
@Astro36
Astro36 / rust-ffi-tutorial.md
Last active May 22, 2023 11:15
Node.js에서 FFI로 Rust를 이용해보자

Node.js에서 FFI로 Rust를 이용해보자

소개

Rust는 성능이 우수한 로우 레벨 프로그래밍 언어 중 하나입니다. 또한, 비용 없는 추상화, 메모리 안정성, 데이터 레이스 없는 스레딩 등등을 지원하며 C++에 비해 문법도 간결합니다. 이러한 장점의 Rust를 Node와 결합시켜 사용한다면, Node의 부족한 성능을 메꿀 수 있습니다. Node에서 Rust에서 작성한 함수를 호출하기 위해서는 FFI(Foreign function interface, 외부 함수 인터페이스)를 사용해야 합니다. 아래는 준비물입니다.

준비물

@MihaelIsaev
MihaelIsaev / CameraViewController.swift
Created April 16, 2015 19:30
This is the example of camera view for iOS written in Swift
import UIKit
import AVFoundation
class ViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
@IBOutlet weak var myView: UIView!
var session: AVCaptureSession?
var device: AVCaptureDevice?
var input: AVCaptureDeviceInput?
@austinhyde
austinhyde / js-observables-binding.md
Last active August 16, 2023 18:19
Vanilla JavaScript Data Binding

Observables

You don't really need a framework or fancy cutting-edge JavaScript features to do two-way data binding. Let's start basic - first and foremost, you need a way to tell when data changes. Traditionally, this is done via an Observer pattern, but a full-blown implementation of that is a little clunky for nice, lightweight JavaScript. So, if native getters/setters are out, the only mechanism we have are accessors:

var n = 5;
function getN() { return n; }
function setN(newN) { n = newN; }

console.log(getN()); // 5

setN(10);

@michaellihs
michaellihs / tmux-cheat-sheet.md
Last active February 21, 2024 07:17
tmux Cheat Sheet
@k2052
k2052 / emacsCoreCommands.md
Created November 16, 2012 18:45
Emacs Shortcuts + Commands

Emacs Commands

Text

  • C-f: move cursor forward one char
  • C-b: mover cursor back one chart
  • C-n: mover cursor to next line
  • C-p: go to previous line
  • M-f: forward one word
  • M-b: move backward one word
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@mjohnsullivan
mjohnsullivan / http_server.rs
Last active March 12, 2024 16:08
Simple HTTP server example for Rust
// Updated example from http://rosettacode.org/wiki/Hello_world/Web_server#Rust
// to work with Rust 1.0 beta
use std::net::{TcpStream, TcpListener};
use std::io::{Read, Write};
use std::thread;
fn handle_read(mut stream: &TcpStream) {
let mut buf = [0u8 ;4096];