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 android.util.AtomicFile | |
import okio.Buffer | |
import okio.Sink | |
import okio.sink | |
import okio.source | |
import java.io.FileOutputStream | |
import java.io.IOException | |
fun AtomicFile.source() = openRead().source() |
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 com.cloudbees.plugins.credentials.* | |
import com.cloudbees.plugins.credentials.common.* | |
import com.cloudbees.plugins.credentials.domains.* | |
import com.cloudbees.plugins.credentials.impl.* | |
import com.cloudbees.jenkins.plugins.sshcredentials.impl.* | |
import org.jenkinsci.plugins.plaincredentials.impl.* | |
// def item = Jenkins.instance.getItem("your-folder") |
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
func setUpMenuButton(){ | |
let menuBtn = UIButton(type: .custom) | |
menuBtn.frame = CGRect(x: 0.0, y: 0.0, width: 20, height: 20) | |
menuBtn.setImage(UIImage(named:"menuIcon"), for: .normal) | |
menuBtn.addTarget(self, action: #selector(vc.onMenuButtonPressed(_:)), for: UIControlEvents.touchUpInside) | |
let menuBarItem = UIBarButtonItem(customView: menuBtn) | |
let currWidth = menuBarItem.customView?.widthAnchor.constraint(equalToConstant: 24) | |
currWidth?.isActive = true | |
let currHeight = menuBarItem.customView?.heightAnchor.constraint(equalToConstant: 24) |
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
package main | |
import ( | |
"io" | |
"net/http" | |
"sync/atomic" | |
) | |
func index() http.Handler { | |
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
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
FROM python:3 | |
MAINTAINER Chris Marks | |
ENV HOST=0.0.0.0 | |
ENV PORT=5000 | |
WORKDIR /app | |
EXPOSE ${PORT} |
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
docker logs nginx 2>&1 | grep "127." | |
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container |
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 android.annotation.TargetApi; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; | |
import android.graphics.drawable.VectorDrawable; | |
import android.os.Build; | |
import android.support.annotation.DrawableRes; | |
import android.support.graphics.drawable.VectorDrawableCompat; |
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
-- Create a group | |
CREATE ROLE readaccess; | |
-- Grant access to existing tables | |
GRANT USAGE ON SCHEMA public TO readaccess; | |
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
-- Grant access to future tables | |
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
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
+ (NSString *)getValueFromCFDictionaryRef { | |
// Assume you have record ID. | |
NSInteger recordID; | |
// Get a person record. | |
ABAddressBookRef addressBook = ABAddressBookCreate(); | |
ABRecordRef person = ABAddressBookGetPersonWithRecordID(addressBook, recordID); | |
// Get addresses data from person. Watch out it's a multi-value property. | |
ABMultiValueRef addresses = ABRecordCopyValue(person, kABPersonAddressProperty); | |
// Get the first one. Convert it from CFDictionaryRef to NSDictionary. | |
NSDictionary *address = (NSDictionary *)CFBridgingRelease(ABMultiValueCopyValueAtIndex(addresses, 0)); |
NewerOlder