Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Hardy stephenhardy

View GitHub Profile
View gist:ee2b0c1f31b26896179133dff12f7fcf
select
t.name table_name
from
sys.tables t
join sys.schemas s on (t.schema_id = s.schema_id)
join sys.partitions p on (t.object_id = p.object_id)
where p.index_id in (0,1)
group by t.name,s.name
having sum(p.rows) = 0;
View Rsync to or from remote
To remote
-----------
rsync -azP file username@remote_host:/home/dir/file
From remote
-------------
rsync -azP username@remote_host:/home/dir/file file
@stephenhardy
stephenhardy / findTablesWithColumnsMySQL.sql
Created May 30, 2016
Find all mysql database tables with specific column names
View findTablesWithColumnsMySQL.sql
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('columnA','ColumnB')
AND TABLE_SCHEMA='YourDatabase';
View mysqldump utf8
mysqldump -u username -p --default-character-set=utf8 --result-file=dumpFile.sql databaseName
View csvToJSON.groovy
@Grab(group = 'com.fasterxml.jackson.dataformat', module= 'jackson-dataformat-csv', version = '2.3.0')
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonPropertyOrder
import com.fasterxml.jackson.core.JsonFactory
import com.fasterxml.jackson.dataformat.csv.CsvMapper
import com.fasterxml.jackson.dataformat.csv.CsvSchema
import com.fasterxml.jackson.databind.MappingIterator
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.ObjectWriter
View gist:5844048

I wrote this in early January 2012, but never finished it. The research and thinking in this area led to a lot of the design of Yeoman and talks like "Javascript Development Workflow of 2013", "Web Application Development Workflow" and "App development stack for JS developers" (surpisingly little overlap in those talks, btw).

Now it's June 2013 and the state of web app tooling has matured quite a bit. But here's a snapshot of the story from 18 months ago, even if a little ugly and incomplete. :p


In the beginning…

  • Intro to tooling
@stephenhardy
stephenhardy / git-clearHistory
Created Apr 26, 2013
Steps to clear out the history of a git/github repository
View git-clearHistory
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
@stephenhardy
stephenhardy / Chrome.sublime-build
Created Apr 25, 2013
Chrome Sublime Text 2 Build System
View Chrome.sublime-build
{
"cmd": ["open", "-a", "Google Chrome", "$file"]
}
You can’t perform that action at this time.