Skip to content

Instantly share code, notes, and snippets.

View ilovejs's full-sized avatar
🐡
mememe, hv a good fish !

Michael Zhuang ilovejs

🐡
mememe, hv a good fish !
  • Sydney
  • 13:14 (UTC +10:00)
View GitHub Profile
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active April 2, 2024 15:19
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@voxxit
voxxit / download-slow-query-log.sh
Last active October 31, 2023 16:13
Downloads RDS slow query logs for the last 24 hours using the AWS CLI
#!/bin/bash
instanceID=$1
date=$(date +%Y%m%d)
function downloadLog () {
local log=$1
aws rds download-db-log-file-portion \
--output text \
@zabirauf
zabirauf / expng.ex
Created July 23, 2015 08:32
PNG format Parser in Elixir
defmodule Expng do
defstruct [:width, :height, :bit_depth, :color_type, :compression, :filter, :interlace, :chunks]
def png_parse(<<
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
_length :: size(32),
"IHDR",
width :: size(32),
height :: size(32),
@swordfeng
swordfeng / chn_fonts.reg
Last active April 29, 2024 11:36
Chinese font settings in wine
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Arial"="wqy-microhei.ttc"
"Arial Black"="wqy-microhei.ttc"
"Arial CE,238"="wqy-microhei.ttc"
"Arial CYR,204"="wqy-microhei.ttc"
"Arial Greek,161"="wqy-microhei.ttc"
"Arial TUR,162"="wqy-microhei.ttc"
"Courier New"="wqy-microhei.ttc"

Let's solve the following physics problem using Symbolism, a computer algebra library for C#.

One strategy in a snowball fight is to throw a first snowball at a high angle over level ground. While your opponent is watching the first one, you throw a second one at a low angle and timed to arrive at your opponent before or at the same time as the first one.

Assume both snowballs are thrown with a speed of 25.0 m/s.

The first one is thrown at an angle of 70.0° with respect to the horizontal.

@ohanhi
ohanhi / frp.md
Last active May 6, 2024 05:17
Learning FP the hard way: Experiences on the Elm language

Learning FP the hard way: Experiences on the Elm language

by Ossi Hanhinen, @ohanhi

with the support of Futurice 💚.

Licensed under CC BY 4.0.

Editorial note

@jayzeng
jayzeng / rds_logs.py
Created April 23, 2015 19:59
get & download rds logs
import subprocess
import json
import os, errno
import argparse
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
@WillSewell
WillSewell / gist:bb4e8db17acd38c30c51
Created April 2, 2015 16:20
Old Pusher "webhook-channel-vacated" integration test
AsyncTest.define("webhook-channel-vacated #{params[:cluster_name]}", checks: 4, timeout: params[:timeout] ) { |t|
channel_name = "channel-existence-#{rand(1000000)}"
params[:webhooks]["/#{params[:cluster_name]}/webhook-channel-vacated"]=Proc.new do |post|
next unless channel_name == (post["events"][0]["channel"] rescue nil)
begin
event_name = post["events"][0]["name"]
pattern = {
"time_ms" => matches{|x| x.kind_of?(Integer)},
"events" => [{ "channel" => channel_name, "name" => event_name }]

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@gmorpheme
gmorpheme / cont.clj
Last active August 29, 2015 14:14
Translation of Chapter 3 of Lisp in Small Pieces into Clojure
(ns ^{:doc "Loose translation of evaluator from chapter three
of Lisp in Small Pieces into Clojure."}
lispic.chapter3.cont
(:refer-clojure :exclude [invoke])
(:require [clojure.test :refer [deftest is]]))
(declare evaluate wrong)
(defn wrong [& args]
(println args)