Skip to content

Instantly share code, notes, and snippets.

View seapy's full-sized avatar

ChangHoon, Jung seapy

View GitHub Profile
//
// SimpleScrollingStack.swift
// A super-simple demo of a scrolling UIStackView in iOS 9
//
// Created by Paul Hudson on 10/06/2015.
// Learn Swift at www.hackingwithswift.com
// @twostraws
//
import UIKit
@hyeshik
hyeshik / 1226 Burger Index.ipynb.json
Last active September 1, 2022 01:36
An IPython notebook for analysis of the distributions of fast-food hamburger shops.
This file has been truncated, but you can view the full file.
{
"metadata": {
"name": "",
"signature": "sha256:f99925a6f73a1e36bc91415d84266705e3bdf72304d8dba7bcfb6c94ca7b270a"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
@dduan
dduan / NSAttributedString+SimpleHTMLTag.swift
Created December 7, 2014 05:59
Convert Simple Text With HTML Tags to NSAttributedString
extension NSAttributedString {
func replaceHTMLTag(tag: String, withAttributes attributes: [String: AnyObject]) -> NSAttributedString {
let openTag = "<\(tag)>"
let closeTag = "</\(tag)>"
let resultingText: NSMutableAttributedString = self.mutableCopy() as NSMutableAttributedString
while true {
let plainString = resultingText.string as NSString
let openTagRange = plainString.rangeOfString(openTag)
if openTagRange.length == 0 {
@lalyos
lalyos / fix-b2d-dns.sh
Last active November 4, 2015 14:25
Fix boot2docker dns - in case changing wifi while b2d is running
#!/bin/bash
#############################
# curl -L j.mp/b2d-dns|bash
#############################
boot2docker ssh "sudo sh -c '/bin/cat > /etc/resolv.conf' " <<< "$(cat /etc/resolv.conf | grep nameserver)"
boot2docker ssh "sudo ip route flush cache"
boot2docker ssh "sudo /etc/init.d/docker restart"
@willurd
willurd / web-servers.md
Last active April 20, 2024 01:40
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@markpundsack
markpundsack / heroku-CVE-2013-0156.rb
Last active November 27, 2023 15:44 — forked from elliottkember/heroku-CVE-2013-0156.rb
Forked from https://gist.github.com/4489689 by elliottkember. CVE-2013-0156 is a nasty vulnerability in many versions of Rails. This script checks all your Heroku apps for this vulnerability in one quick (slow) move. More info: https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
## The quick-and-nasty CVE-2013-0156 Heroku inspector!
## Originally brought to you by @elliottkember with changes by @markpundsack @ Heroku
## Download and run using:
## ruby heroku-CVE-2013-0156.rb
`heroku list`.split("\n").each do |app|
app = app.strip
# Some "heroku apps" lines have === formatting for grouping. They're not apps.
next if app[0..2] == "==="
@jimeh
jimeh / README.md
Created January 17, 2010 14:20
A simple key/value store model for Rails using the database and memcache

Rails Setting model

This is a semi-quick key/value store I put together for a quick way to store temporary data related to what's in my database, in a reliable way. For example, I'm using it to keep track of where a hourly and a daily crontask that processes statistics left off, so it can resume only processing and summarizing new data on the next run.

Code quality most likely is not great, but it works. And I will update this gist as I update my project.

How It Works

The settings table has two columns, a key and a value column. The value column is serialized, so you can technically store almost anything in there. Memcache is also used as a caching layer to minimize database calls.