This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
protocol Alphabet { | |
associatedtype AlphabetCharacter: Comparable, Hashable | |
func allCharacters() -> [AlphabetCharacter] | |
init() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GIFLoader.h | |
// AnimatedGifExample | |
// | |
// Created by Andrei on 10/15/12. | |
// Copyright (c) 2012 Whatevra. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define NNodes 22 | |
int Sum, Min, x, y, n, m, c, f[NNodes], st[NNodes], a[NNodes][NNodes]; | |
void back(int k) { | |
if(k == n + 1) { | |
if(a[st[n]][st[1]] > 0) { | |
Sum += a[st[n]][st[1]]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let a = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
prop_regex = /@property\s*\([^\)]+\)\s+(?<type>\w+(\s*\*)?)\s*(?<name>\w+)/ | |
code = `pbpaste` | |
property_list = [] | |
code.scan(prop_regex) do |match| | |
type, name = match |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[self observe:UIDeviceOrientationDidChangeNotification on:@selector(orientationChanged:)]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def random_element | |
self[Random.rand(length)] | |
end | |
end | |
namespace :events do | |
desc "Do stuff every hour" | |
task every_hour: :environment do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
clipboard = `pbpaste` | |
if clipboard.match /https?:\/\/w?w?w?\.((youtube)|(listenonrepeat))\.com\/.*/ | |
# Youtube / Listen on repeat | |
if clipboard["youtube"] != nil | |
clipboard["youtube"] = "listenonrepeat" | |
elsif clipboard["listenonrepeat"] != nil | |
clipboard["listenonrepeat"] = "youtube" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Invalidate a call if it's been less that 1 second since the last one | |
//===================================================================== | |
static NSDate *lastDate = nil; | |
NSDate *currentDate = [NSDate date]; | |
if (lastDate != nil && | |
[currentDate timeIntervalSinceDate:lastDate] < 1) { | |
return ; | |
} | |
lastDate = currentDate; | |
//===================================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DERIVED_DATA_PATH = "~/Library/Developer/Xcode/DerivedData/" | |
def projects | |
`ls -al #{DERIVED_DATA_PATH}`.split("\n")[3..-1].map { |p| | |
ls_components = p.split(" ") | |
project_name = ls_components.last | |
if project_name != "ModuleCache" | |
project_name = project_name.split("-")[0..-2].join("-") | |
else |
NewerOlder