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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 DataAdapter extends RecyclerView.Adapter<DataAdapter.ViewHolder> { | |
ArrayList<String> countries; | |
public DataAdapter(ArrayList<String> countries) { | |
this.countries = countries; | |
} | |
@Override | |
public DataAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { | |
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.card_row, viewGroup, false); |
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
adduser username | |
passwd username | |
usermod -aG wheel username | |
su - username |
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 static IConfigurationRoot configuration; | |
public static void Main(string[] args) | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(Directory.GetCurrentDirectory()) | |
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); | |
configuration = builder.Build(); |
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
declare @TableName sysname = 'TableName' | |
declare @Result varchar(max) = 'public class ' + @TableName + ' | |
{' | |
select @Result = @Result + ' | |
public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; } | |
' | |
from | |
( | |
select |
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
CREATE FUNCTION [dbo].[fnDatetoUnix] ( | |
@ctimestamp datetime | |
) | |
RETURNS integer | |
AS | |
BEGIN | |
/* Function body */ | |
declare @return integer | |
SELECT @return = DATEDIFF(SECOND,{d '1970-01-01'}, @ctimestamp) |
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 void setContentView(int layoutResID,int actionbarId) { | |
View newLayout = getLayoutInflater().inflate(R.layout.template_activity_1,null,false); | |
ViewGroup viewGroup = newLayout.findViewById(R.id.m_new_root); | |
ViewGroup.LayoutParams para = new ViewGroup.LayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); | |
View oldRoot =getLayoutInflater().inflate(layoutResID,viewGroup,false); | |
newLayout.setLayoutParams(para); | |
viewGroup.addView(getLayoutInflater().inflate(actionbarId,viewGroup,false)); | |
viewGroup.addView(oldRoot); |
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
/* Drop all non-system stored procs */ | |
DECLARE @name VARCHAR(128) | |
DECLARE @SQL VARCHAR(254) | |
SELECT @name = (SELECT TOP 1 [name] FROM sysobjects WHERE [type] = 'P' AND category = 0 ORDER BY [name]) | |
WHILE @name is not null | |
BEGIN | |
SELECT @SQL = 'DROP PROCEDURE [dbo].[' + RTRIM(@name) +']' | |
EXEC (@SQL) |
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
Intent intent = new Intent(); | |
intent.setAction(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse("geo:35.734481, 51.406799?z=20")); | |
startActivity(intent); |
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
firewall-cmd --zone=public --add-port=3306 /tcp --permanent | |
firewall-cmd --reload |
OlderNewer