step | REST gsg: CORS w/jQy client | REST gsg: plain json |
---|---|---|
1 | Create Resource Representation Class: Greeting.java - POJO plus no arg constructor |
Create Resource Representation Class: Greeting.java- just a POJO |
2 | Create Resource Controller: GreetingController.java - imports GetMapping , a shortcut for RequestMapping - imports CrossOrigin |
Create Resource Controller: GreetingController.java - imports RequestMapping |
3 | /greeting route is mapped | /greeting route is mapped |
4 | use @RestController annotation and default to using the Jackson Json converter | use @RestController annotation and default to using the Jackson Json converter |
5 | add @CrossOrigin annotation above @Getmapping | -- |
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
var remote = require('remote') | |
var ipc = require('ipc') | |
var Menu = remote.require('menu') | |
var menu = Menu.buildFromTemplate([ | |
{ | |
label: 'Electron', | |
submenu: [ |
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/bash | |
for file in /etc/* | |
do | |
if [ "${file}" == "/etc/resolv.conf" ] | |
then | |
countNameservers=$(grep -c nameserver /etc/resolv.conf) | |
echo "Total ${countNameservers} nameservers defined in ${file}" | |
break | |
fi | |
done |
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
//Beauty in one line | |
ls | cat -n | while read n f; do mv "$f" "$n.extension"; done | |
change extension with desired PNG, Jpg or some-other. | |
//Try to use a loop, let, and printf for the padding: |
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
assuming that the file you want to edit is my.txt | |
$cat my.txt | |
this is the regular file | |
And the file you want to prepend is header | |
$ cat header | |
this is the header | |
Be sure to have a final blank line in the header file. | |
Now you can prepend it with |
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 simplejson | |
from flask import Flask, g, request | |
from couchdb.design import ViewDefinition | |
import flaskext.couchdb | |
app = Flask(__name__) | |
""" | |
CouchDB permanent view |
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
# -*- coding: utf-8 -*- | |
""" | |
Flaskr | |
~~~~~~ | |
A microblog example application written as Flask tutorial with | |
Flask and couchdbkit. | |
:copyright: (c) 2010 by Armin Ronacher. | |
:license: BSD, see LICENSE for more details. |
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
print("let's try 'listDatabases'"); | |
dblist = JSON.stringify( db.adminCommand('listDatabases'), undefined, 2); | |
// stringify options 2 & 3 add pretty-like spaces | |
print(dblist) ; |
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
fruit = ['apple', 'avocado', 'orange', 'kiwi', 'grape', 'pineapple', 'raspberry', 'bluet', 'pineapple', 'raspberry', | |
'avocado', 'orange', 'kiwi', 'grape','apple', 'avocado', 'orange', 'kiwi', 'grape', 'pineapple'] | |
def analyze_list(l): | |
counts = {} | |
for item in l: | |
if item in counts: | |
counts[item = counts[item] + 1 | |
else: |
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
Private Sub openDialog() | |
Dim fd As Office.FileDialog | |
Set fd = Application.FileDialog(msoFileDialogFilePicker) | |
With fd | |
.AllowMultiSelect = False | |
' Set the title of the dialog box. |
OlderNewer