Skip to content

Instantly share code, notes, and snippets.

View nk-gears's full-sized avatar
💥
experimenting...

Nirmal nk-gears

💥
experimenting...
View GitHub Profile
@nk-gears
nk-gears / gist:f5d00ed882c781a58ab9
Created November 30, 2014 17:16
POST JSON from OBJ-C
NSString *queryString = [NSString stringWithFormat:@"http://chrisrisner.com/Labs/day7test.php?name=%@", [self.txtName text]];
NSMutableURLRequest *theRequest=[NSMutableURLRequest
requestWithURL:[NSURL URLWithString:
queryString]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];
NSDictionary* jsonDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
@"Value1", @"Key1",
@"Value2", @"Key2",
nil];
@nk-gears
nk-gears / gist:67949dce98e4fd0f111a6797c97a1f10
Created August 29, 2016 09:59 — forked from ishikawa/gist:88599
Java Sample Code for Calculating HMAC-SHA1 Signatures
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Formatter;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
@nk-gears
nk-gears / learn-dynamodb.md
Created November 1, 2016 11:12 — forked from teohm/learn-dynamodb.md
personal reading notes about DynamoDB tips & gotcahs

Disclaimer: I'm super new to DynamoDB, so if you found I wrote something incorrect or stupid, just kindly send me a comment :)


Learn DynamoDB

  • database -> tables -> items -> attributes
  • db = a collection of tables
@nk-gears
nk-gears / index-spec.js
Created November 19, 2016 08:45 — forked from abruzzi/index-spec.js
E2E test in AngularJS by using protractor
describe("index page", function() {
beforeEach(function() {
browser.get("http://localhost:9999/app/index.html");
});
it("should have navigator", function() {
expect(element("#navigator")).toBeDefined();
});
it("should have input box", function() {
@nk-gears
nk-gears / convertSheet2Json.gs
Created November 28, 2016 13:40 — forked from daichan4649/convertSheet2Json.gs
spreadsheet のデータを JSON として読み込む(Google Apps Script)
function convertSheet2Json(sheet) {
// first line(title)
var colStartIndex = 1;
var rowNum = 1;
var firstRange = sheet.getRange(1, 1, 1, sheet.getLastColumn());
var firstRowValues = firstRange.getValues();
var titleColumns = firstRowValues[0];
// after the second line(data)
var lastRow = sheet.getLastRow();
@nk-gears
nk-gears / jenkins-ec2-continous-integration.md
Created December 11, 2016 09:00 — forked from stephenharris/jenkins-ec2-continous-integration.md
How to set up CI with Jenkins on AWS EC2 (and some notes)
package ca.uwo.csd.cs2212.USERNAME;
public class BankAccount {
private double balance;
public BankAccount(double balance) {
this.balance = balance;
}
packages:
yum:
git: []
gcc: []
make: []
openssl-devel: []
commands:
00-add-home-variable:
command: sed -i 's/function error_exit/export HOME=\/root\n\nfunction error_exit/' /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh
container_commands:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Test template for creating a beanstalk environment",
"Parameters" : {
"VPC": {
"Description" : "The AWS VPC to use.",
"Type": "AWS::EC2::VPC::Id"
},
"SubnetA": {
"Description" : "The Subnet in AZ A.",
@nk-gears
nk-gears / cftemplate-eb.json
Created December 21, 2016 15:39 — forked from GeneralistDev/cftemplate-eb.json
Cloud Formation Template (danielparker.com.au) WordPress and Elastic Beanstalk
{
"Outputs":{
"AWSEBLoadBalancerURL":{
"Value":{
"Fn::Join":[
"",
[
"http:\/\/",
{
"Fn::GetAtt":[