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
public class TestApp { | |
/** | |
* @param args the command line arguments | |
*/ | |
public static void main(String[] args) { | |
//Try with list of set values | |
List<Integer> listSet = new ArrayList<Integer>(); | |
listSet.add(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
#!/bin/bash | |
# | |
# Use agvtool to set Xcode project build number and create git tag | |
# Note: requires Xcode project configured to use Apple Generic Versioning and git | |
# | |
# Usage: set_agv_ver.sh 123 | |
# | |
# src: https://gist.github.com/rob-murray/8644974 | |
# |
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
# app/models/blog_post.rb | |
class BlogPost < Post | |
has_many :comments | |
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
require 'digest' | |
def main | |
raise ArgumentError, 'Please specify a file to work with' unless ARGV.length == 1 | |
file_path = ARGV[0] | |
digest = Digest::MD5.base64digest(File.read( file_path )) | |
puts "The MD5 digest base64 encoded MD5 is #{digest} of file #{file_path}." | |
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
2.1.5 :020 > User | |
=> User(id: integer, name: string, email: string, created_at: datetime, updated_at: datetime) | |
2.1.5 :021 > User.create(name: 'rob', email: 'orb@example.com') | |
(0.1ms) begin transaction | |
SQL (1.0ms) INSERT INTO "users" ("name", "email", "created_at", "updated_at") VALUES (?, ?, ?, ?) [["name", "rob"], ["email", "orb@example.com"], ["created_at", "2015-01-09 08:50:31.962223"], ["updated_at", "2015-01-09 08:50:31.962223"]] | |
(0.8ms) commit transaction | |
=> #<User id: 2, name: "rob", email: "orb@example.com", created_at: "2015-01-09 08:50:31", updated_at: "2015-01-09 08:50:31"> | |
2.1.5 :022 > User.first | |
User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1 | |
=> #<User id: 2, name: "rob", email: "orb@example.com", created_at: "2015-01-09 08:50:31", updated_at: "2015-01-09 08:50:31"> |
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
#1 Generate Public & Private Keypair | |
#2 Create receipt.json - eg below - careful with line-endings, etc if line breaks | |
#3 Create signature & Encode | |
openssl dgst -binary -sha1 -sign private.pem receipt.json | openssl base64 > signature.txt | |
#4 Verify using OpenSSL & public key | |
openssl base64 -d -in signature.txt -out signature.sha1 | openssl dgst -sha1 -verify public.pem -signature signature.sha1 receipt.json | |
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
# frozen_string_literal: true | |
# rubocop:disable | |
def puts_here(symbol: "*") | |
puts symbol + caller(1..1).first + symbol * 50 | |
if block_given? | |
yield | |
puts symbol + caller(1..1).first + symbol * 50 | |
end | |
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
!bin/sh | |
##################################### | |
### Backup script - run_backup.sh ## | |
##################################### | |
### Desc: Runs backup on MYSQL ## | |
### database and then emails to ## | |
### confirm ## | |
##################################### | |
# Settings |
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
<?php | |
namespace ACompany\AnAppName\Dao\PdoImpl; | |
/** | |
* PDOConnection is a singleton implementation. | |
* getConnection() returning an instance of PDO connection. | |
* | |
* <code> | |
* Example usage: |
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
rails new app_name \ | |
--database=postgresql \ | |
--skip-action-cable --skip-action-mailer --skip-active-storage \ | |
--skip-sprockets --skip-action-mailbox --skip-action-text \ | |
--skip-bundle --skip-keeps --skip-spring --skip-test \ | |
--skip-coffee --skip-system-test --skip-turbolinks | |