src
├── layouts
│ └── default.html
├── pages
│ └── index.html
├── data
│ └── i18n
│ ├── cn.json
│ └── template.html
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
const listeners = (function listAllEventListeners() { | |
let elements = []; | |
const allElements = document.querySelectorAll('*'); | |
const types = []; | |
for (let ev in window) { | |
if (/^on/.test(ev)) types[types.length] = ev; | |
} | |
for (let i = 0; i < allElements.length; i++) { | |
const currentElement = allElements[i]; |
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
import xml.etree.cElementTree as ElementTree | |
import json, pytz, zipfile, unicodedata, re | |
from datetime import datetime | |
from os import listdir | |
from os.path import isfile, join | |
import glob | |
def slugify(value): | |
""" | |
Normalizes string, converts to lowercase, removes non-alpha characters. |
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
const listeners = (function listAllEventListeners() { | |
let elements = []; | |
const allElements = document.querySelectorAll('*'); | |
const types = []; | |
for (let ev in window) { | |
if (/^on/.test(ev)) types[types.length] = ev; | |
} | |
for (let i = 0; i < allElements.length; i++) { | |
const currentElement = allElements[i]; |
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
var http = require('http'); | |
exports.handler = function(event, context) { | |
http.get('http://httpbin.org/get', function(res) { | |
var body = ''; | |
res.on('data', function(chunk) { | |
body += chunk; | |
}); | |
res.on('end', function() { |
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
// Promise.all is good for executing many promises at once | |
Promise.all([ | |
promise1, | |
promise2 | |
]); | |
// Promise.resolve is good for wrapping synchronous code | |
Promise.resolve().then(function () { | |
if (somethingIsNotRight()) { | |
throw new Error("I will be rejected asynchronously!"); |
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
# See your sequence name inside psql console with \ds command. | |
ALTER SEQUENCE seq RESTART WITH 1; | |
# Update sequence | |
UPDATE table_name SET id=nextval('seq'); |
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
controllers.controller('MainCtrl', function($scope, $location, Facebook, $rootScope, $http, $location, Upload, Auth, User, Question, Category, Serie, Record, Location, Popup, Process, Card, Question) { | |
$scope.$on('authLoaded', function() { | |
$scope.isExpert($scope.main.serieId); | |
$scope.isMember($scope.main.serieId); | |
}); | |
$scope.loadAuth = function() { | |
Auth.load().success(function(data) { | |
$scope.main.user = data.user; | |
$scope.$broadcast("authLoaded"); |
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
/** | |
* A function to take a string written in dot notation style, and use it to | |
* find a nested object property inside of an object. | |
* | |
* Useful in a plugin or module that accepts a JSON array of objects, but | |
* you want to let the user specify where to find various bits of data | |
* inside of each custom object instead of forcing a standardized | |
* property list. | |
* | |
* @param String nested A dot notation style parameter reference (ie "urls.small") |