Skip to content

Instantly share code, notes, and snippets.

View NatashaTheRobot's full-sized avatar

Natasha Murashev NatashaTheRobot

View GitHub Profile
@glessard
glessard / shuffle.swift
Last active June 29, 2018 02:48
Shuffle a CollectionType
//
// shuffle.swift
//
// Created by Guillaume Lessard on 2014-08-28.
// Copyright (c) 2016 Guillaume Lessard. All rights reserved.
//
// https://github.com/glessard/shuffle
// https://gist.github.com/glessard/7140fe885af3eb874e11
//
func optional_pair1<T,U>(t: T?, u: U?)->String {
switch (t,u) {
// every case exhaustively covers the possibilities
case (.None,.None): return "neither"
case let (.Some(t), .Some(u)): return "both"
case let (.Some(t),.None): return "left"
case let (.None,.Some(u)): return "right"
// so no need for a default clause at all
// this way, you are totally explicit about
// which case is being handled how.
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 4, 2024 21:33
A badass list of frontend development resources I collected over time.
@NatashaTheRobot
NatashaTheRobot / psql
Created July 21, 2012 17:05 — forked from rubyonrailstutor/psql
psql code
development:
adapter: postgresql
encoding: unicode
database: url_development
pool: 5
username: jd
password:
host: localhost
port: 5432
<!DOCTYPE html>
<html lang='en'>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<meta charset="UTF-8">
<style>
.cell{
width:50px ;
height:50px;
padding: 0px;
class Position
attr_reader :x, :y
@cache_of_positions = {}
def self.new_with_memo(x,y)
@cache_of_positions[[x,y]] || Position.new(x,y).tap do |instance|
@cache_of_positions[[x,y]] = instance
end
end
@dhoerl
dhoerl / KeychainItemWrapper.h
Last active April 4, 2023 08:15
KeychainItemWrapper ARCified. Added the ability to manage a dictionary in place of just a string - the #define PASSWORD_USES_DATA in the .m file switches the mode.
/*
File: KeychainItemWrapper.h
Abstract:
Objective-C wrapper for accessing a single keychain item.
Version: 1.2 - ARCified
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of