This file contains hidden or 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
| require 'rubygems' | |
| require 'sinatra' | |
| require 'dm-core' | |
| DataMapper::Logger.new($stdout, :debug) | |
| DataMapper.setup(:default, 'sqlite3::memory:') | |
| # Don't use this in production code! Extending lots of objects during runtime | |
| # will have a negative impact on performance/memory because ruby clears out | |
| # the method cache. |
This file contains hidden or 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 <dispatch/dispatch.h> | |
| #import <objc/runtime.h> | |
| @implementation MySingleton | |
| static MySingleton * __singleton = nil; | |
| + (MySingleton *) sharedInstance_accessor | |
| { | |
| return ( __singleton ); |
This file contains hidden or 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
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: redis-server | |
| # Required-Start: $syslog | |
| # Required-Stop: $syslog | |
| # Should-Start: $local_fs | |
| # Should-Stop: $local_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: redis-server - Persistent key-value db |
This file contains hidden or 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
| # Xcode Auto-Versioning | |
| # | |
| # Updates your Info.plist's CFBundleVersion with the current git tag and/or sha. | |
| # | |
| # based on https://github.com/elliottcable/xcode-git-versioner | |
| # | |
| # Usage: | |
| # 1. Right-click the target you want to add the versioning phase to (usually the target that builds your app) | |
| # 2. Select: Add -> New Build Phase -> New Run Script Build Phase | |
| # 3. Specify /usr/bin/env ruby as the shell for the script |
This file contains hidden or 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 Exception | |
| alias_method :_message, :message | |
| def message | |
| "#{_message}\t\n#{backtrace.join("\t\n")}" | |
| end | |
| end |
This file contains hidden or 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
| defaults write "${TARGET_BUILD_DIR}"/"${CONTENTS_FOLDER_PATH}"/Info GitVersion `git describe --always --tags --dirty` |
This file contains hidden or 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
| // checks if already in current queue, prevents deadlock | |
| void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_block_t block) { | |
| if (dispatch_get_current_queue() == queue) { | |
| block(); | |
| }else { | |
| dispatch_sync(queue, block); | |
| } | |
| } | |
| // problem: |
This file contains hidden or 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.collectionView = ({ | |
| UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init]; | |
| UICollectionView *collectionView = [[UICollectionView alloc] initWithFrame:self.view.bounds | |
| collectionViewLayout:flowLayout]; | |
| collectionView.delegate = self; | |
| collectionView.dataSource = self; | |
| collectionView; |
This file contains hidden or 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
| module ActiveRecord | |
| class Connection | |
| def connect | |
| Thread.current.thread_variable_set(:connection_id, 123) | |
| end | |
| end | |
| end | |
| module Sequel | |
| class Connection |
This file contains hidden or 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
| defmodule Mix.TasksServer do | |
| @moduledoc false | |
| use GenServer.Behaviour | |
| def start_link() do | |
| :gen_server.start_link({ :local, __MODULE__ }, __MODULE__, :ok, []) | |
| end | |
| def clear_tasks() do | |
| call :clear_tasks |
OlderNewer