Skip to content

Instantly share code, notes, and snippets.

View adamdahan's full-sized avatar
🎯
Focusing

Adam Dahan adamdahan

🎯
Focusing
  • Toronto
View GitHub Profile
@adamdahan
adamdahan / gist:810f73ff9d89a0f32c53
Created May 20, 2015 17:34
Get the class name of an AnyObject in Swift
let className = NSStringFromClass(obj.dynamicType)
@adamdahan
adamdahan / download-image.swift
Last active October 26, 2015 18:32
Async image download swift
var image: UIImage?
var imageURL = "Some url"
if let url = NSURL(string: imageURL) {
let request: NSURLRequest = NSURLRequest(URL: url)
let mainQueue = NSOperationQueue.mainQueue()
NSURLConnection.sendAsynchronousRequest(request, queue: mainQueue, completionHandler: { (response, data, error) -> Void in
if error == nil {
let image = UIImage(data: data)
dispatch_async(dispatch_get_main_queue(), {
// Update image
![Ruby cheatsheet version 0.1](https://github.com/adamdahan/lighthouse-web/blob/master/ruby-cheatsheet-v-0.1/image/ruby-cheatsheet-v-0.1.png)
@adamdahan
adamdahan / 0_reuse_code.js
Created February 14, 2016 03:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
# Require any necessary gems
require 'active_record'
require 'pry'
require 'sqlite3'
ActiveRecord::Base.establish_connection(
adapter: 'sqlite3',
database: ':memory:'
)
import Foundation
protocol ServiceLocator {
func getService<T>(type: T.Type) -> T?
func getService<T>() -> T?
}
extension ServiceLocator {

LLDB Cheat Sheet

A complete gdb to lldb command map.

Print out

  • Print object
(lldb) po responseObject
(lldb) po [responseObject objectForKey@"state"]
  • p - Print primitive type
@adamdahan
adamdahan / curl.md
Created January 24, 2018 05:32 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@adamdahan
adamdahan / postgres-cheatsheet.md
Last active August 14, 2018 17:08 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Running SQL files against the database

psql -f thefile.sql targetdatabase

Magic words:

<template>
<div class="container">
<div class="columns" style="margin-top: 40px;">
<div class="column is-12">
<div class="tabs is-toggle">
<ul>
<li :class="[ setting === 'account' ? 'is-active' : '']">
<a @click="setting='account'">
<span class="icon is-small"><i class="fas fa-user" aria-hidden="true"></i></span>
My Profile